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

Showing data diff between months

Good morning Power-BI lovers! I've got a question for you all. Lets suppose i have the following example table:

Example.PNG

Right now it shows the ammount of connections for each version each different month.

I want to change it so the numbers shown will be the difference between the column month and the previous one, something like

Version     July     August     September
2.1.0          +4            +1                   -5
2.1.1         +56          +15                 -18
3.5           +102          -5                    -60

Any thoughs?     

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

1.  Add a conditional column.

diff.PNG

2. Create measures.

LastMonthValue =
VAR CurrentMonth =
    MAX ( 'Table'[MonthNo.] )
RETURN
    IF (
        MAX ( 'Table'[MonthNo.] )
            = CALCULATE ( MIN ( 'Table'[MonthNo.] ), ALL ( 'Table' ) ),
        0,
        CALCULATE (
            MAX ( 'Table'[Value] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Version] ),
                'Table'[MonthNo.] = CurrentMonth - 1
            )
        )
    )
Difference = FORMAT(MAX('Table'[Value])-[LastMonthValue],"+0;-0")

diff2.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

 

1.  Add a conditional column.

diff.PNG

2. Create measures.

LastMonthValue =
VAR CurrentMonth =
    MAX ( 'Table'[MonthNo.] )
RETURN
    IF (
        MAX ( 'Table'[MonthNo.] )
            = CALCULATE ( MIN ( 'Table'[MonthNo.] ), ALL ( 'Table' ) ),
        0,
        CALCULATE (
            MAX ( 'Table'[Value] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Version] ),
                'Table'[MonthNo.] = CurrentMonth - 1
            )
        )
    )
Difference = FORMAT(MAX('Table'[Value])-[LastMonthValue],"+0;-0")

diff2.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hey @Icey , thanks for pointing that out.

I'm actually not so good at DAX and, while I understand the idea of this function, I'm not able to make it work.
I've checked DAX documentation and it seems that CALCULATE uses ; to separate statements, maybe thats a typo in your solution?
I will post below my DAX function errrors, in case it helps you to point out what I am doing wrong

Capture.PNG
Also, I'm attaching how my table looks right now. 'Values' is the count of rows grouped by Version and Month

Capture.PNG

I will keep trying to modify it. If I find out what am I doing wrong I will post about it!

Thanks a lot, regards
Mark.

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Maybe you can manually enter this formula in Power BI. Sometimes this issue will disappear after this operation.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi Mark

If the columns of your dataset are static, then why not just create columns that calculate the difference between the months? That way you also don't overwrite existing data, which is best practise.

Let me know if this helps?

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.