Forum Discussion
Locco
4 years agoHelper III
Count changes in a value/column
I have a set of data and I need to count the amount of times there were changes in a value. My data is setup similar to this... TableA DateTime Part Quantity 9/20/2021 12:00:00 am 8...
- 4 years ago
This turned out to be context issue that was solved by using ALLSELECTED versus ALL:
Changed Column = VAR __DateTime = [DateTime] VAR __PreviousDateTime = MAXX(FILTER(ALLSELECTED('Table'),[DateTime]<__DateTime),[DateTime]) VAR __PreviousPart = MAXX(FILTER(ALLSELECTED('Table'),[DateTime]=__PreviousDateTime),[Part]) RETURN IF([Part]=__PreviousPart,0,1)
Greg_Deckler
4 years agoCommunity Champion
Locco I don't get those results at all. See Table23 and Page 5 of attached PBIX below sig. Also the 5:23 PM line does change parts numbers from 11436 to 11438. All I can say is that either we have different data or you aren't translating the DAX correctly.
Locco
4 years agoHelper III
Thanks Greg_Deckler, I appreciate your help and patience.
In your book, you are using measures. I've been using calculated columns and never used measures. You have a column, "Changed Column GJD," this also returns the same incorrect value which is in my book.
Should I be using measures or calculated columns?