Forum Discussion
YTD Based on slicer
Hi,
I would like to show YTD figure on the report based on month slicer. So if I choose Septemer from the Month slicer, the table will give me YTD figure from Jan-Sep, if I choose August from the month slicer, the table will give me YTD figure from Jan-Aug. Currently, no matter which month that I select from the month slicer, the Actual YTD will show Jan-current month, as there is no data available for future month, which is 796,349.
The measure that I am using now for Actual YTD is:
4 Replies
- amitchandak
Super User
Check if this can work for you
Sales YTD on LYTD = Var _start_date=(minx('Date',STARTOFYEAR('Date'[Date]))) Var _end_date=(max('Date'[Date])) Var _last_year_mtd_val= CALCULATE(sum(Sales[Sales Amount]),Sales[Sales Date] >= _start_date && (Sales[Sales Date]) <= _end_date,filter(Sales,COUNTROWS(SAMEPERIODLASTYEAR(Sales[Sales Date]))>0)) return _last_year_mtd_valAppreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
Thanks. - kentyler
Solution Sage
Here is a past question and answer that describes your problem https://community.powerbi.com/t5/Desktop/YTD-as-dynamic-value-using-DAX/td-p/383404
The answer describes the technique as a "whatif" table, but the more generic name for the pattern is "parameter table" which has a good explanation here https://www.daxpatterns.com/parameter-table/
- vblbiserviceFrequent Visitor
Dear Team,
Do you have power bi file to solve this issue. I am facing this issue too. Much appreciated if team can help.
Thanks!
Aynar
- Ashish_Mathur
Super User
Hi,
Share some data, explain the question and show the expected result.