Forum Discussion
Anonymous
3 years agoNot applicable
Getting Previous Row using DAX measure
Hello all, I need to get previous record based on DateTime column and grouped by TagIndex column I created this measure, Prev_value_Energy_consum = VAR Index = [Index] VAR Prev_date =...
- 3 years ago
Hi,
Thank you for your sharing.
Could you please try the below if it works?
Prev_value_Energy_consum = VAR Index = [Index] VAR Prev_datetime = MAXX ( FILTER ( ALLSELECTED ( FloatTable ), FloatTable[Date] = SELECTEDVALUE ( FloatTable[Date] ) && FloatTable[Time] < SELECTEDVALUE ( FloatTable[Time] ) ), FloatTable[Time] ) VAR Prev_date = MAXX ( FILTER ( ALLSELECTED ( FloatTable ), FloatTable[Date] < SELECTEDVALUE ( FloatTable[Date] ) ), FloatTable[Date] ) VAR Prev_time = MAXX ( FILTER ( ALLSELECTED ( FloatTable ), FloatTable[Date] = Prev_date ), FloatTable[Time] ) RETURN SWITCH ( TRUE (), NOT ISBLANK ( Prev_datetime ), CALCULATE ( SUMX ( FloatTable, VAR Index = FloatTable[TagIndex] RETURN FloatTable[Val] ), FILTER ( ALLSELECTED ( FloatTable ), FloatTable[Time] = Prev_datetime && FloatTable[Date] = SELECTEDVALUE ( FloatTable[Date] ) && FloatTable[TagIndex] = Index ) ), CALCULATE ( SUMX ( FloatTable, VAR Index = FloatTable[TagIndex] RETURN FloatTable[Val] ), FILTER ( ALLSELECTED ( FloatTable ), FloatTable[Time] = Prev_time && FloatTable[Date] = Prev_date && FloatTable[TagIndex] = Index ) ) )
Anonymous
3 years agoNot applicable
Hi Jihwan_Kim
Sorry I think I was not able to explain you clearly.
I was saying I want to see 0 on the last record of the table not on the grand total, and I have done that by modifying the measure. You can see the screenshot
But now issue is, in the grand total of Test Measure it is not summing the values of that column it is showing some different value.
I am confused in this issue and I would be really greatful if it is resolved 🙂
Thanks and Regards
Mihir
Jihwan_Kim
3 years agoSuper User
Hi,
May I ask what is the number that you want to see on Grand total?