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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
RichWyeth
Frequent Visitor

Subtract values from different rows

Hi,

 

I have a table that tracks company headcount (Headcount_C) and I also have a Month_Year column and a Rolling_Month column.

I would like to know the difference between each month, using either the Month_Year or Rolling_Month.

 

Rolling Month        Month_Year                  Headcount_C        (Difference)

1                             October 2016               6000                       -21

2                             September 2016          6021                       +3

3                             August 2016                6018                       +1

 

I am struggling to get this working, I have tried using PreviousMonth and DatesInPeriod, but I can't seem to get the result I want.
I have also surrounded my statement with IF(Headcount_C>0,............

Is there a way to get this working using the rolling month?

 

All help appreciated.

1 REPLY 1
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @RichWyeth,

 

According to your description, you should be able to use the formula below to create a calculate column in this scenario. (Assume your table is called "Table1".)

Difference = 
VAR rm = Table1[Rolling Month]
VAR hc = Table1[Headcount_C]
RETURN
    hc
        - CALCULATE (
            MAX ( Table1[Headcount_C] ),
            ALL ( Table1 ),
            Table1[Rolling Month]
                = rm + 1
        )

 

Regards

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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