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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RRaj_293
Helper III
Helper III

Distinct count of a field based on Sequence of Process - DAX

Hello , 

 

I want to count the distinct IDs which have completed the process cycle which is from 'New Email' to 'Complete' only. Other IDs with an incomplete process cycle which does not End with a 'Complete' or start with 'New Email'  needs to be ignored. 

 

IDProcess StatusSeq
11ANEW EMAIL10
11APROCESSING20
11APROCESSING TRANSFORMATION30
11APROCESSING TRANSFORMATION30
11APROCESSING TRANSFORMATION30
11APROCESSING OUTPUT40
11AVALIDATING50
11AWORKQUEUE70
11ACOMPLETE100
12ANEW EMAIL10
12APROCESSING20
12APROCESSING TRANSFORMATION30
12APROCESSING TRANSFORMATION30
12APROCESSING TRANSFORMATION30
12APROCESSING OUTPUT40
12AVALIDATING50
12AWORKQUEUE70
12ACOMPLETE100
13BNEW EMAIL10
13BPROCESSING 20
13BTERMINATING1000
14CNOTIFICATION99
15DNEW EMAIL10
15D

PROCESSING

 

20

 

In the above example Only IDs - 11A and 12A have completed the process hence I need a count of 2 as my result.

 

Tried this which didn't work!

Test_Msr = CALCULATE(Distinctcount(ID) , FILTER( Min(seq = 10) && Max(seq = 100))) 

 

Can someone please help me with the dax!

 

 

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@RRaj_293 , Try using below DAX

 

Test_Msr =
CALCULATE(
DISTINCTCOUNT('Table'[ID]),
FILTER(
'Table',
'Table'[ID] IN
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Process Status] = "NEW EMAIL" && 'Table'[Seq] = 10
),
"ID", 'Table'[ID]
) &&
'Table'[ID] IN
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Process Status] = "COMPLETE" && 'Table'[Seq] = 100
),
"ID", 'Table'[ID]
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

ThxAlot
Super User
Super User

ThxAlot_0-1725873176049.png

ThxAlot_1-1725873221601.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



View solution in original post

3 REPLIES 3
RRaj_293
Helper III
Helper III

Thanks @ThxAlot  and @bhanu_gautam  Issue is resolved. 

ThxAlot
Super User
Super User

ThxAlot_0-1725873176049.png

ThxAlot_1-1725873221601.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



bhanu_gautam
Super User
Super User

@RRaj_293 , Try using below DAX

 

Test_Msr =
CALCULATE(
DISTINCTCOUNT('Table'[ID]),
FILTER(
'Table',
'Table'[ID] IN
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Process Status] = "NEW EMAIL" && 'Table'[Seq] = 10
),
"ID", 'Table'[ID]
) &&
'Table'[ID] IN
SELECTCOLUMNS(
FILTER(
'Table',
'Table'[Process Status] = "COMPLETE" && 'Table'[Seq] = 100
),
"ID", 'Table'[ID]
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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