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

Calculating daily increase where date has gap

I have a table with Date and Sales. I want to calculate daily increase. Just want to know the previous day's sales. However my dates are not in order. There are lot of missing dates. I tried to use PREVIOUSDAY and DATEADD functions. But it is not helping because there is gap in my date. Please help me with the DAX formula.
ResultDailyIncreatse = PREVIOUSDAY(Date[Date])
DATEADD(Date[Date], -1, DAY)

hasannuman100_0-1652119572551.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I cannot edit the Sales_Table in the Power Query. So I create a new table instead of Sales_Table. You can try my operations on Sales_Table.

vpollymsft_0-1652322507214.png

 

Click Home>>Transform data>>Add column>> Add index column>> From 1. Like the following:

vpollymsft_2-1652322796684.png

 

vpollymsft_1-1652322723910.png

Then create a measure on Sales_Table.

Measure =
VAR _nextvalue =
    CALCULATE (
        MAX ( 'Table'[sales] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Index]
                = SELECTEDVALUE ( 'Table'[Index] ) + 1
        )
    )
VAR _noevalue =
    MAX ( 'Table'[sales] )
RETURN
    _nextvalue - _noevalue

Or a column.

Column =
VAR _nextvalue =
    CALCULATE (
        MAX ( 'Table'[sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = EARLIER ( 'Table'[Index] ) + 1 )
    )
VAR _noevalue = 'Table'[sales]
RETURN
    _nextvalue - _noevalue

 

vpollymsft_3-1652322949595.png

Best Regards
Community Support Team _ Polly

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
Anonymous
Not applicable

Hi @Anonymous ,

I cannot edit the Sales_Table in the Power Query. So I create a new table instead of Sales_Table. You can try my operations on Sales_Table.

vpollymsft_0-1652322507214.png

 

Click Home>>Transform data>>Add column>> Add index column>> From 1. Like the following:

vpollymsft_2-1652322796684.png

 

vpollymsft_1-1652322723910.png

Then create a measure on Sales_Table.

Measure =
VAR _nextvalue =
    CALCULATE (
        MAX ( 'Table'[sales] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Index]
                = SELECTEDVALUE ( 'Table'[Index] ) + 1
        )
    )
VAR _noevalue =
    MAX ( 'Table'[sales] )
RETURN
    _nextvalue - _noevalue

Or a column.

Column =
VAR _nextvalue =
    CALCULATE (
        MAX ( 'Table'[sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = EARLIER ( 'Table'[Index] ) + 1 )
    )
VAR _noevalue = 'Table'[sales]
RETURN
    _nextvalue - _noevalue

 

vpollymsft_3-1652322949595.png

Best Regards
Community Support Team _ Polly

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

 

 

Anonymous
Not applicable

Thank you @Anonymous very much for your reply. It helped me a lot. I apprciate for your help 😀

Anonymous
Not applicable

Hi @tamerj1 

Thank you for willing to help. Yes this is a table visual and I have a date table. I am trying to create a measure. But calculted column will help as well if we can get the accurate result. Please find the attached file.

https://drive.google.com/file/d/1euQWRuYiH7Svm2pR2-UstXP56YeooWGF/view?usp=sharing

 

tamerj1
Super User
Super User

Hi @Anonymous 

I guess this is a table visual? Shall I assume that you have date table? Are the results summarized by sum? Are trying to create a measure or a calculated column 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.