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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Subtract todays total from previous days total

Hi all! I am trying to create a column where it takes the dates total_installed and subtracts the previous dates total_installed.

 

My table 'DATA' looks like this:

DATE              Total_installed
20/11/2023    68900
19/11/2023    68896
18/11/2023    68893
17/11/2023    68738
16/11/2023    68556
15/11/2023    68340
14/11/2023    68099
13/11/2023    67897


The additional column would look like this:

DATE              Total_installed    New_installs
20/11/2023    68900                 4
19/11/2023    68896                 3
18/11/2023    68893                 155
17/11/2023    68738                 182
16/11/2023    68556                 216
15/11/2023    68340                 241
14/11/2023    68099                 202
13/11/2023    67897                 0


Obviously easy to do in Excel or SQL but new to DAX and it is a bit beyond me. Appreciate any suggestions or solutions. 

I have found similar questions but I am unable to reverse engineer the formula to work with my own data. Thanks all!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

OFFSET function (DAX) - DAX | Microsoft Learn

 

Jihwan_Kim_0-1700510326994.png

 

 

New Installs CC =
VAR _previous =
    MAXX (
        OFFSET (
            -1,
            SUMMARIZE ( Data, Data[DATE], Data[Total_installed] ),
            ORDERBY ( Data[DATE], ASC )
        ),
        Data[Total_installed]
    )
RETURN
    IF ( NOT ISBLANK ( _previous ), Data[Total_installed] - _previous, 0 )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

OFFSET function (DAX) - DAX | Microsoft Learn

 

Jihwan_Kim_0-1700510326994.png

 

 

New Installs CC =
VAR _previous =
    MAXX (
        OFFSET (
            -1,
            SUMMARIZE ( Data, Data[DATE], Data[Total_installed] ),
            ORDERBY ( Data[DATE], ASC )
        ),
        Data[Total_installed]
    )
RETURN
    IF ( NOT ISBLANK ( _previous ), Data[Total_installed] - _previous, 0 )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Absolute legend. Works perfectly and the formula actually makes sense, which is the most imporant part. Thank you 🙂 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.