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)
Locco
4 years agoHelper III
It finally updated the card with "Changed Measure Total TD" and instead of the 34 it says in your book, it says 52k. It seems like the measure does not see the filter(s) which have been applied and is applying the measurement to the entire column regards of any filtered/sliced value.
Edit: Was able to fix this by changing ALL in the measure formula to VALUES, but the measure still returns the same value as the column formula (which is not the right value).
Greg_Deckler
4 years agoCommunity Champion
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)