Hello,
Here is what I think is a simple question, but I can't seem to get it to work. I'm trying to use a table to show sales by product in this year and last year. The issue comes when I had sales last year but not this year.
The data is structured like this:
Year Product Sales
2021 A 50
2021 B 25
2021 C 100
2022 B 75
2022 C 100
But when I use CALCULATE([Sales],SAMEPERIODLASTYEAR('Calendar'[Date])), it drops product A since there are no sales this year.
Desired output is this:
Product | 2022 | 2021 |
A | 0 | 50 |
B | 75 | 25 |
C | 100 | 100 |
But instead, I get this:
Product | 2022 | 2021 |
B | 75 | 25 |
C | 100 | 100 |
Thanks in advance!
Solved! Go to Solution.
Given the volume of data, that isn't possible (what I showed was a very simplified view). However, I have found a work around in the way the source data is produced which makes it easier when I pull it into PBI.
Thanks!
Hi @PowerBINewbie81 ,
Please add 0 to the original formula of [Sales], like this.
Sales = SUM('Table'[Sales]) + 0
Table:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Given the volume of data, that isn't possible (what I showed was a very simplified view). However, I have found a work around in the way the source data is produced which makes it easier when I pull it into PBI.
Thanks!