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.
Hello,
I have a set of data with sales, customers, sales reps, and month & year. I'm trying to pull last the previous year sales with
Prior Year Sales = CALCULATE( SUM( 'Sales Data'[Sales]), DATEADD( 'Sales Data'[Date], -1, YEAR ) )
I'm checking it in a matrix set up as Rows: Year, Quarter, Month. Values: Sales and Prior Year Sales.
The sales column is just fine. The Previous Year Sales column is populating as blanks everywhere except a total at the bottom.
Please help me with this.
Ryan
Solved! Go to Solution.
Hi @rynoh22,
As I tested, you'd better create a Calendar table, create a relationship between Calendar table and Sales Data table.
Create measure using the following formula.
Prior Year Sales = CALCULATE( SUM( 'Sales Data'[Sales]), DATEADD( 'Calendar'[Date], -1, YEAR ) )
Create a table visual, select Calendar[Date].Year, Calendar[Date].Quarter as rows, you will get expectd result.
If you have other issues, please feel free to ask.
Best Regards,
Angelia
I am having similar issue. Very simple file yet not able to get the YoY values. Can you help me understand where I am wrong?
Hi @rynoh22,
As I tested, you'd better create a Calendar table, create a relationship between Calendar table and Sales Data table.
Create measure using the following formula.
Prior Year Sales = CALCULATE( SUM( 'Sales Data'[Sales]), DATEADD( 'Calendar'[Date], -1, YEAR ) )
Create a table visual, select Calendar[Date].Year, Calendar[Date].Quarter as rows, you will get expectd result.
If you have other issues, please feel free to ask.
Best Regards,
Angelia
Hey
I have followed the query. But table is depicting the next year as well.
Can you help with that?
That worked. I think my issue was that I was using the Date field from the Sales Data Table instead of the Date table.
Thank you @v-huizhn-msft
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |