Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Seasonal Indexes of products

Hello,

I struggle with seasonal indexing DAX formulas. I have 4 years data - and for them i have created measure like this:

 

Seasonal_Index= (Measurement[SELECTED_VIEWS_AVG]/(Measurement[ALL_VIEWS_AVG])*100)


SELECTED_VIEWS_AVG = CALCULATE((SUM(Views[Value])/DISTINCTCOUNT(Date[Year AND month number])))


AND


ALL_VIEWS_AVG = CALCULATE(DIVIDE(SUM(Views[Value]),DISTINCTCOUNT(Date[Year AND month number])),ALLEXCEPT(Date,Date[YEAR]))

 

and it is working correctly - shows seasonality of products on the basis of views value. But it calculates its average on all dates I have so for 4 years and I would like to have every month compared to its year like Jun 2018 compared to average of year 2018 and not all of the years.

 

I wrote something like this (the same, I added only DATESINPERIOD filter for last 12 months (so Year 4) because I want to compare every year, but I started with Year 4. And there is added "if" condition because I need to have index higher than 120 taken into consideration which will be useful for further calculations)

 

Seasonal_Index_Y4 = IF(CALCULATE((Measurement[SELECTED_VIEWS_AVG_Y4]/(Measurement[ALL_VIEWS_AVG_Y4])*100) > 120), CALCULATE( (Measurement[SELECTED_VIEWS_AVG_Y4]/(Measurement[ALL_VIEWS_AVG_Y4])*100)))


and

 

ALL_VIEWS_AVG_Y4 = CALCULATE([AVG_Month_Y4],DATESINPERIOD(Date[Date],MAX(Date[Date]),-12,MONTH) )

 

And 

 

AVG_Month_Y4 = CALCULATE( DIVIDE(SUM(Views[Value]),DISTINCTCOUNT(Date[Year AND month number])),ALLEXCEPT(Date,Date[Year AND month number]))

 

AND

 

SELECTED_VIEWS_AVG_Y4 = CALCULATE((SUM(Views[Value])/DISTINCTCOUNT(Date[Year AND month number])), DATESINPERIOD(Date[Date],MAX(Date[Date]),-12,MONTH) )

 

it works (I mean does not show errors) however does not show proper seasonalities, shows seasonality on graph on e.g. March when it is not the season for such product. It is not correct.

 

Thank you for any tips and suggestions if I can use other filter, maybe you notice any mistake in my formulas or maybe I should take other approach to write the fomula to have compared it to seperate year correctly.

 

Thank you!

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , if you need avg of year, then you need to try

 

CALCULATE((SUM(Views[Value])/DISTINCTCOUNT(Date[Year AND month number])), previousyear(Dateadd(Date[Date],1,Year) ))

 

 

CALCULATE((SUM(Views[Value])/DISTINCTCOUNT(Date[Year AND month number])), filter( all(Date), Date[Year]  = max(Date[Year])  ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.