Forum Discussion
Only show months that contain data
Hello, I am making a dashboard that shows the accidents in the last 12 months, but I cannot get them to be displayed, since months appear without data, I hope you can help me.
Make your measures return BLANK() for the months without data. Make sure you use a proper calendar table, and disable auto date/time
- Anonymous1 year ago
Hi DiegoARdzO ,
I think you can use Slicer visual to achieve your requirement, so I create two tables as you mentioned.
Then I create two measures and here are the DAX codes.
Total Sales = SUM('Sales'[Amount])Total Sales Last Year = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( Dates[Date] ) )Next you can use Slicer and get what you want.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlin
Super User
Make your measures return BLANK() for the months without data. Make sure you use a proper calendar table, and disable auto date/time
- AnonymousNot applicable
Hi DiegoARdzO ,
I think you can use Slicer visual to achieve your requirement, so I create two tables as you mentioned.
Then I create two measures and here are the DAX codes.
Total Sales = SUM('Sales'[Amount])Total Sales Last Year = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( Dates[Date] ) )Next you can use Slicer and get what you want.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.