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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
nzboan
New Member

%Var between previous date

Hey, everyone, I've been trying to calculate this, but I'm really stuck. Here is the problem:

 

I want to show in % the difference between months of 2016 and 2017. For example :

 

January 2016: 10

January 2017: 11

% diff: +10%

 

Thanks in advance 😄

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

If the following conditions are met

 

  1. You have a calendar table
  2. There is a relationship from the Date column of your data table to the date column of your calendar table
  3. You extract year and month in the calendar table
  4. You drag Year and Month from the calendar table into the visual

 

then, this measure will work

 

=SUM(Data[Value])/CALCULATE(Data[Value]),PREVIOUSMONTH(Calendar[Date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @nzboan,

 

You can use below formula to calculate the diff between current year month total and previous year month total.

Measure:

Diff = 
VAR CYM =
    CALCULATE (
        SUM ( Records[Amount] ),
        FILTER (
            ALLSELECTED ( Records ),
            YEAR ( [Date] ) = YEAR ( MAX ( [Date] ) )
                && MONTH ( [Date] ) = MONTH ( MAX ( [Date] ) )
        )
    )
VAR PYM =
    CALCULATE (
        SUM ( Records[Amount] ),
        FILTER (
            ALLSELECTED ( Records ),
            YEAR ( [Date] )
                = YEAR ( MAX ( [Date] ) ) - 1
                && MONTH ( [Date] ) = MONTH ( MAX ( [Date] ) )
        )
    )
RETURN
    DIVIDE ( CYM - PYM, PYM, 0 )

4.PNG

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors