Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello, I have a FACT table where I'm trying to sum up the current year sales and prior year sales (side by side in a matrix chart) using the sameperiodlastyear DAX function. I want the matrix to show ALL records from both years (i.e., if sales for a particular country were generated last year, but not in the current year, I want those records displayed as well). The problem is the sameperiodlastyear function will only retrieve records from the prior year ONLY IF current year sales exists. Otherwise, all prior years records that don't exist in the current year will be filtered out. Any idea on how I can modify the measures to include all sales from both years?
Solved! Go to Solution.
Thanks, it was my data model that was not producing the correct result
Hi,
I am not sure if I understood correctly about your data model., but please check the below picture and the attached pbix file.
Sales total sameperiodlastyear: =
CALCULATE (
[Sales total current year:],
SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)
Thanks, it was my data model that was not producing the correct result
Hi, @iluvcoding_91
If the issue is resolved, you can close this thread by marking the relevant reply as solution.
Best Regards,
Community Support Team _ Eason
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |