Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
metcala
Helper III
Helper III

Count of records processed out of order

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

 

IDStatusStatus Updated
1Started

1/1/23

1Pre-checks2/1/23
1Processing3/1/23
1Complete4/1/23

2

Started

1/1/23

2

Processing2/1/23

2

Pre-checks3/1/23

2

Complete4/1/23

...

......

 

Order

 

StatusOrder
Started

1

Pre-checks2
Processing3
Complete4

 

In the above example I'd expect:

1 complete application

1 incorrect order 

 

Any pointers would be really really appreciated!

 

Thanks

1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

hi, @metcala 
 tyr below measure 
 

Adjust Name For YourTable

countofid =
var a = ADDCOLUMNS(VALUES(status[id]),"a1",CALCULATE(COUNT(checkingtable[status])))
return
COUNTAX(FILTER(a,[a1]>3),status[id])
 
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Dangar332
Super User
Super User

hi, @metcala 
 tyr below measure 
 

Adjust Name For YourTable

countofid =
var a = ADDCOLUMNS(VALUES(status[id]),"a1",CALCULATE(COUNT(checkingtable[status])))
return
COUNTAX(FILTER(a,[a1]>3),status[id])
 
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

hi, @metcala 

i am gonna upload pbix. file in which i mention little bit description so refer Here 

and for more dax knowledge refer Sqlbi website

Abhinav054
Helper I
Helper I

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)))

some_bih
Super User
Super User

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!





Did I answer your question? Mark my post as a 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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.