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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bombom
Helper I
Helper I

Power BI count distinct IDs with a condition

I have a data that looks like this:


DateTicketIdStepResult
01.01.2020 13:00:001234562Successfull
01.01.2020 13:00:001234564Successfull
01.01.2020 13:00:051234568Error
01.01.2020 13:05:001234562Successfull
01.01.2020 13:05:001234564Successfull
01.01.2020 13:05:051234568Error
01.01.2020 13:10:001234562Successfull
01.01.2020 13:10:001234564Successfull
01.01.2020 13:10:051234568Error
01.01.2020 13:15:001234562Successfull
01.01.2020 13:15:001234564Successfull
01.01.2020 13:05:006543212Successfull
01.01.2020 13:05:006543214Successfull
01.01.2020 13:05:056543218Error
01.01.2020 13:10:006543212Successfull
01.01.2020 13:10:006543214Successfull
01.01.2020 13:10:056543218Error
01.01.2020 13:15:006543212Successfull
01.01.2020 13:15:006543214Successfull
01.01.2020 13:10:000987652Successfull
01.01.2020 13:10:000987654Successfull
01.01.2020 13:10:050987658Error
01.01.2020 13:10:000987652Successfull
01.01.2020 13:10:000987654Successfull
01.01.2020 13:10:050987658Error

 

From that data I have a matrix that calculates the distinct quantity of TicketIDs that have a step = 8 (Result = 'Error').

 

I need a DAX measure to calculate distinct number of TicketIDs if the TicketID have the Result = 'Successfull' as a last, before he had a Result = 'Error'. Note that next I will need to drillthrogh through the mesaure up to found TicketId.

Example of the desired output:


DateCount_distinct_TickedId_with_ErrorsCount_distinct_TickedId_with_Successfull_and_Errors_before
01.01.202032

 

It's a 123456 and 654321 TickedIds.

 

Current DAX measure to calculate distinct TickedIds with errors looks like this:

  1. LogDistcount_ = DISTINCTCOUNT(Logging[TicketId])
  2. Errors_dist = CALCULATE(Logging[LogDistcount_], Logging[Step] = 😎

And also, if it's not hard, the measure to calculate the TickedId, which is still have an Error result as at last.


DateCount_distinct_TickedId_with_ErrorsCount_distinct_TickedId_with_Successfull_and_Errors_beforeCount_distinct_TickedId_with_Errors_still
01.01.2020321

 

It's a 098765.

 

Many thanks!

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @bombom ,

 

Depending on your requirements, you want to implement a measure [calculate distinct number of TicketIDs if the TicketID have the Result = 'Successfull' as a last], but I didn't fully understand the logic you want to output after looking at your Example of the desired output.

If it is convenient, can you write your Example of the desired output and populate it in the reply so that we can fully understand your needs?

 

Best Regards,

Neeko Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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