Forum Discussion
Delta calculation based on dynamic Slicer
- 6 years ago
Hi ilui ,
Based on your description, you can create this measure:
Forecast Diff = VAR _max = CALCULATE ( MAX ( 'Table'[Snapshot Date] ), ALLSELECTED ( 'Table' ) ) VAR _min = CALCULATE ( MIN ( 'Table'[Snapshot Date] ), ALLSELECTED ( 'Table' ) ) VAR _maxsum = CALCULATE ( SUM ( 'Table'[Forecast] ), 'Table'[Snapshot Date] = _max ) VAR _minsum = CALCULATE ( SUM ( 'Table'[Forecast] ), 'Table'[Snapshot Date] = _min ) RETURN _maxsum - _minsumTo achieve the same visual, create two matrix to use visual overlay:
Attached the sample file that hopes to help you: Forecast data.pbix
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
ilui , You can use day vs last day and take a diff. Use date table.
Example
Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
Diff COlumn = datediff(maxx(filter(Table,Table[Date]<earlier(Table[Date]) && Table[Numberf]= earlier(Table[Numberf]) ),Table[Date]) ,Table[Date],Day)
This Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
Last Day = CALCULATE(sum('order'[Qty]), previousday('Date'[Date]))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
The snapshot date is not necessarily Day -1. The snapshot data is twice a week so the date can be
20200511
20200516
20200518 etc etc
also, are below a number of Measures? or 1 measure?