Forum Discussion
curiouspbix0
6 years agoHelper IV
Compare Previous to Prior Value
Hi DAXerts, Spare Dax to compare previous value to prior value for the most recent time entry for a given City and Station. Input Table City Station Measurement Time Brooklyn S...
- 6 years ago
Hi curiouspbix0 ,
Create a column as below:
Arrow = var _previoustime=CALCULATE(MAX('Table'[Time]),FILTER('Table','Table'[Time]<EARLIER('Table'[Time])&&'Table'[City]=EARLIER('Table'[City])&&'Table'[Station]=EARLIER('Table'[Station]))) var _previousmeasure=CALCULATE(MAX('Table'[Measurement]),FILTER('Table','Table'[Time]=_previoustime&&'Table'[City]=EARLIER('Table'[City])&&'Table'[Station]=EARLIER('Table'[Station]))) Return IF(_previousmeasure=BLANK(),BLANK(),IF('Table'[Measurement]>_previousmeasure,UNICHAR ( 9650 ), UNICHAR ( 128315 ) ))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
v-kelly-msft
6 years agoCommunity Support
Hi curiouspbix0 ,
Create a column as below:
Arrow =
var _previoustime=CALCULATE(MAX('Table'[Time]),FILTER('Table','Table'[Time]<EARLIER('Table'[Time])&&'Table'[City]=EARLIER('Table'[City])&&'Table'[Station]=EARLIER('Table'[Station])))
var _previousmeasure=CALCULATE(MAX('Table'[Measurement]),FILTER('Table','Table'[Time]=_previoustime&&'Table'[City]=EARLIER('Table'[City])&&'Table'[Station]=EARLIER('Table'[Station])))
Return
IF(_previousmeasure=BLANK(),BLANK(),IF('Table'[Measurement]>_previousmeasure,UNICHAR ( 9650 ), UNICHAR ( 128315 ) ))
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!