I want 10 oldest requests based on the received date ascending with a specific condition. I’m not sure how can I apply this on the calculation. I have days pending already calculated in a table and I need to implement to get the 10 oldest pending requests by office and received date.
I have written this calculation
CALCULATE(SUM(table[days_pending]),
FILTER(ALLEXCEPT(table, table[office]),
(table[Fiscal_Year_Closed] >= MAX(table[Fiscal_Year]) &&
table[Fiscal_Year] < MAX(table[Fiscal_Year]))))
but I’m not sure how can I get the 10 oldest received dates along with this condition (table[Fiscal_Year_Closed] MAX(table[Fiscal_Year]) && table[Fiscal_Year] < MAX(table[Fiscal_Year] applied.
Something like to convert this sql statement in powerbi syntax.
select top 10 office, received_date, sum(days_pending) from table where Fiscal_Year_Closed >= '2024' and Fiscal_Year < '2024' group by received_date, office order by received_date asc
How can I go about achieving this? Thanks in advance!
[![enter image description here][1]][1]
Add a new table to your model with the following:
Table Name:
Dim OldestPendingRequest
The table doesn't need to have any relationships created. Set the
Column
to beSort by...
Column sort
.Then create a measure with:
Now you should be able to create a Matrix with:
table[office]
'Dim OldestPendingRequest'[Column]
[10 Oldest Pending Requests]