Forum Discussion
Slicing with multiple calculation groups
Hi,
I'm trying to create a report to slice my measure through multiple calculation groups :
- Units
- Date Period
- Type of metric
And my issue is that I'm trying to calculate a market share for the past year but the sameperiodlastyear function is not working for me, and when I check the first date in my table, it seems like my date filter context is ignored withing my matrix.
Sorry I cannot share with you my data model.
Thanks in advance for you time.
Regards
3 Replies
- amitchandakSuper User
WSeirafi , can you please share the formula used? Make sure you are using Date table
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.- WSeirafiHelper I
Of course.
Here is my market share formula
VAR AllVolume = CALCULATE ( [Selected Sales Unit], ALL ( 'Source Product'[Source Manufacturer], 'Source Product'[Source Brand Name], 'Source Product'[Source Pack Name] ) ) RETURN DIVIDE ( [Selected Sales Unit], AllVolume, 0 )
And my past year formula
VAR AllVolume = CALCULATE ( [Selected Sales Unit], ALL ( 'Source Product'[Source Manufacturer], 'Source Product'[Source Brand Name], 'Source Product'[Source Pack Name] ) ) VAR CY = DIVIDE ( [Selected Sales Unit], AllVolume, 0 ) RETURN CALCULATE ( CY, SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
I have one global market share measure with the same formula as well, that is not in the calculation group, but not working too.
And yes I'm using a date table of course.
- WSeirafiHelper I
I just fixed it by myself and it seems working, but in a nutshell I had to use SAMEPERIODLASTYEAR in the intermediate calculations, using it in the final line was not working for a reason I ignore