Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I want to show previous year value for total sales for the time range that has been selected in the slicer.
Suppose in this slicer I have selected a date range of 02-02-2016 to 04-05-2016 so the total value of sales to be displayed should be
of previous year i.e, 02-02-2015 to 04-05-2015.
There is a dax function SAMEPERIODLASTYEAR that will do this https://msdn.microsoft.com/en-us/library/ee634972.aspx
@MattAllingtonMy data is transactional data. In slicer it has invoice date and the function that you suggested gives the formula like
CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))
Can you please tell me what is (DateTime[DateKey]) is it a different table for calendar.? As in this scenario I want us invoice date in place of DateTime[DateKey] As my report is depenedent on invoice date. Can you sugggest me a way to do this.
This is my DAX -:
Previous Year Measure = CALCULATE(SUM('table1'[Total]), SAMEPERIODLASTYEAR('table1'[Invoice Date].[Date]))
This does not show the correct data.
Power BI has layers of functionality. If you just want to add columns of data then you can just use a single table. If you want to perform time intelligence calculations, you need a calendar table. Here are a couple of my articles that will help.
https://exceleratorbi.com.au/power-pivot-calendar-tables/
https://exceleratorbi.com.au/dax-time-intelligence-beginners/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |