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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculate the index of one month in year 2 relative to same month in year 1

Hi All,

 

I am currently working on a report, where I need help to calculate the sales index (percentage) of each month for year 2 and compare it with the same months for year 1. I have no idea how to do this. I have tried to copy the exact same table in and then make simple division calculations, but it seems to complicate matters further, as I wish to not only compare 2021 vs 2022 but also like 2022 vs 2016 etc. Can anybody help with this? Thank you in advance!

 

Month2021 (units)2022 (units)Index

Jan

32942342%
Feb5029201%
Mar123450%
Apr23980%
May32450%
Jun14560%
Jul32450%
Aug21340%

 

8 REPLIES 8
TheoC
Super User
Super User

Hi @ 

 

You can create the following measure:

 

Movement % = 

VAR _1 = SUM ( Table[Amount] )
VAR _2 = CALCULATE ( SUM ( Table[Amount] ) , SAMPERIODLASTYEAR ( Date[Date] ) )
RETURN
IF ( AND ( _1 <> 0 , _2 <> 0 ) , DIVIDE ( _1 - _2 , _2 ) )

If you don't have a Date table, then use the Date column from your data table to replace Date[Date].  Also, make sure you convert to a % in the Format field! 

TheoC_0-1643787546307.png

 

Hope this helps 🙂

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

Hi Theo,

 

Thank you for your response. I have problems getting the correct percentage calculation. I have used your calculation and inserted my own table amounts:

 

Movement KFP % =

VAR _1 = SUM (Orders[Number of KFP] )
VAR _2 = CALCULATE ( SUM ( Orders[Number of KFP] ) , SAMEPERIODLASTYEAR ( 'Date'[Date]) )
RETURN
IF ( AND ( _1 <> 0 , _2 <> 0 ) , DIVIDE ( _1 - _2 , _2 ))
 
However, I get the following output. (Disregard the DFP). Here it shows the wrong %, as Movement KFP of 2022 should be around 59% rather than 0.78%. Also, can I somehow do so movement KFP only appears at the far right and not after 2021 as well?
 
Screenshot.PNG
 
Thank you in advance.
 
Best,
Christian

Hi @Anonymous 

 

Do you have a Date table established in your data model?

 

It definitely should work.  Here is a screenshot of it operational:

 

TheoC_0-1643841669581.png

If you don't have a Date table, what is your Date column?


Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

Hi Theo,

 

I have added a table for Dates as seen below

Udklip.PNG

 

However, the data is supposed to track a delivery date and not the date that it was recorded. Therefore I also have this column:

Udklip1.PNG

@Anonymous okay, sweet.

 

Do you have a relationship between the Date[Date] and Orders[Delivery Date] established?

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@ckolby If for some reason the relationship aspect doesn't resolve your issue, you can try the to create the following independent measures:

 

Sum = SUM ( Orders[Number of KFP] )
CurYr = CALCULATE ( [Sum] , DATESYTD ( 'Date'[Date] )
PriorYr = CALCULATE ( [Sum] , SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Mov YoY % = 

VAR _1 = [CurYr] - [PriorYr]
VAR _2 = _1 / [CurYr]
RETURN
IF ( _2 = 0 , 0 , _2 )

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

Dear Theo,

 

Thank you very much for your response. It is highly appreciated!

 

I have connected the file with the date in following fashion. (and tried other cardinalities, but nothing seems to work). When I connect the two (delivery date and date), the Delivery Date seems to unformat itself, so it no longer is a date format - and I don't seem to be able to change such.

Udklip.PNG

 

I have also tried the measures you created:

SumofKFP = sum(Orders[Number of KFP])
CurYr = CALCULATE ( [SumofKFP] , DATESYTD ( Orders[Delivery Date]))
PriorYr = CALCULATE ( [SumofKFP] , SAMEPERIODLASTYEAR ( Orders[Delivery Date] ) )
Mov YoY % =

VAR _1 = [CurYr] - [PriorYr]
VAR _2 = _1 / [CurYr]
RETURN
IF ( _2 = 0 , 0 , _2 )

 

This gives me such output:

Udklip1.PNG

 

Thank you in advance!

amitchandak
Super User
Super User

@ , You can use two slicer approach. refer my video for that

 

How to use two Date/Period slicers :https://www.youtube.com/watch?v=WSeZr_-MiTg

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors