Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I would like to compare last year's sales based on the date selection. For example, if the date selected is April 1-15, 2024, the previous year column should show the sales for April 1-15, 2023.
I created 2 sample measures based on SAMEPERIODLASTYEAR and DATEADD but it seems that I am missing something. The PREVIOUS YEARS show the same as the current year (selected date range). Thanks.
Solved! Go to Solution.
Hi,
Create a Calendar Table with a relationship (Many to One and Single) from the Date column of sheet1 to the Date column of the Calendar Table. To your visual/slicer/filter, drag Date from the Calendar Table. Write these measures:
Total = SUM('Sheet1'[SALES])
Total in SPLY = CALCULATE(SUM('Sheet1'[SALES]), sameperiodlastyear(calendar[date]))
Hope this helps.
Hi,
Create a Calendar Table with a relationship (Many to One and Single) from the Date column of sheet1 to the Date column of the Calendar Table. To your visual/slicer/filter, drag Date from the Calendar Table. Write these measures:
Total = SUM('Sheet1'[SALES])
Total in SPLY = CALCULATE(SUM('Sheet1'[SALES]), sameperiodlastyear(calendar[date]))
Hope this helps.
You are welcome.
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |