The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi
Really struggling to write a DAX measure that provides a total of applications that have been completed out of order.
I have the following tables:
Status
ID | Status | Status Updated |
1 | Started | 1/1/23 |
1 | Pre-checks | 2/1/23 |
1 | Processing | 3/1/23 |
1 | Complete | 4/1/23 |
2 | Started | 1/1/23 |
2 | Processing | 2/1/23 |
2 | Pre-checks | 3/1/23 |
2 | Complete | 4/1/23 |
... | ... | ... |
Order
Status | Order |
Started | 1 |
Pre-checks | 2 |
Processing | 3 |
Complete | 4 |
In the above example I'd expect:
1 complete application
1 incorrect order
Any pointers would be really really appreciated!
Thanks
Solved! Go to Solution.
hi, @metcala
tyr below measure
Adjust Name For YourTable
hi, @metcala
tyr below measure
Adjust Name For YourTable
Thank you so much! That's worked perfectly.
Sorry if this question isn't allowed but I am trying to decipher exactly how this works so I don't need to ask again. I don't suppose you could explain what is happening in the variable and COUNTAX function?
Many thanks!
hii,
Total_Correct_Applications = CALCULATE(
COUNTX(
FILTER(
VALUES('Status'[ID]),
CALCULATE(MAX('Status'[Order])) = MAX('Status'[Order]) ), 1 ) )
Hi
Thanks so much for the reply but it seems to be returning 2 for the example above.
For clarity, I am looking for it to:
Count an ID if each stage in date order for that ID is completed in the order defined in the Stage Order table
Thanks
Once try this
Total_Correct_Order_Applications =
CALCULATE(
COUNTAX(
VALUES('Status'[ID]),
VAR MaxOrder = MAX('Order'[Order])
RETURN
IF (
NOT(ISBLANK(MaxOrder)) &&
COUNTROWS(FILTER('Status', 'Status'[Order] = MaxOrder)) > 0,
1, 0)))
Hi @metcala possible solution as measure for complete status below; adjust name for YourTable.
Measure complete=
CALCULATE(
DISTINCTCOUNT(YourTable[ID]),
YourTable[Status]="Complete"
)
Did I answer your question? Kudos appreciated / accept solution!
Proud to be a Super User!
Hi, thanks for the reply but that doesn't account for checking if the ID has been completed out of order.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |