Forum Discussion
cinderelly678
3 years agoFrequent Visitor
DAX Measure Help: Counting Status Changes Over Time
I am having some trouble writing a measure which would count the number of times a status has changed for a particular item. My source is an SDC Type 2 table containing all history of status changes....
- 3 years ago
cinderelly678 Try:
Measure = VAR __Fruit = MAX('Table'[Fruit]) VAR __TS = MAX('Table'[Timestamp]) VAR __Table = DISTINCT(SELECTCOLUMNS(FILTER(ALL('Table'), [Fruit] = __Fruit && [Timestamp] <= __TS), "__Status", [Consumable Status])) VAR __Result = COUNTROWS(__Table) RETURN __Result
cinderelly678
3 years agoFrequent Visitor
Greg_Deckler , thank you very much, that worked like a charm!
Now I have a secondary question. Let's say I wanted to iterate over the results of the Measure to flag when the measure has incremented by one over the previous value. How could I achieve that?
- Greg_Deckler3 years agoCommunity Champion
cinderelly678 That's Cthulhu. Cthulhu - Microsoft Fabric Community
- cinderelly6783 years agoFrequent Visitor
Oh goodness -- sweet post! Let me try to wrap my head around this.
I'll likely respond with questions soon.
Thank you so much for sharing Greg_Deckler !