Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I am trying to pull up the "DataPointValue" for the privious day (hoping to use this in a calculation).
Below is the snapshot of the data:
Current Formula used:
Solved! Go to Solution.
@sv11,
Is DataPointValue as existing field in your table? Please check my PBIX file.
Regards,
Lydia
I believe you want EARLIER like this:
Previous Row = VAR __previousDate = MAXX(FILTER(ALL('Table'),[AsOfDate] < EARLIER([AsOfDate])),[AsOfDate]) VAR __previous = MAXX(FILTER(ALL('Table'),[AsOfDate] = __previousDate),[DataPointValue]) RETURN __previous
See my article on Mean Time Before Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...
Thank you for yor response. I have tried cleating a column based on your suggested script. The values do not seem to be matching.
There are multiple "InstrumentDescription"'s for each date and I guess the calculation is is not grouping the data for each "InstrumentDescription" and pulling in the respective previous value.
What do you suggest?
Thanks a ton for your help.
@sv11,
Please change your DAX to the following:
Previous Row = VAR __previousDate = MAXX(FILTER(ALL('Table'),[AsOfDate] < EARLIER([AsOfDate])&&'Table'[InstrumentDescription]=EARLIER('Table'[InstrumentDescription])),[AsOfDate]) VAR __previous = MAXX(FILTER(ALL('Table'),[AsOfDate] = __previousDate),[DataPointValue]) RETURN IF(ISBLANK(__previous),0,__previous)
Regards,
Lydia
Thank you for your response and insight on DAX.
I have made changes to DAX as suggested, but I am still having trouble in pulling in the correct Previous value.
This did solve part of my requirement (Starting with 0).
Please find the snapshot below:
Ideally, the highlighted values should be the same.
Here is the DAX code I used:
@sv11,
Is DataPointValue as existing field in your table? Please check my PBIX file.
Regards,
Lydia
Thanks Lydia. This really helps.