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 September 15. Request your voucher.

Reply
Jenn_Hill_13
New Member

If statement for days with no data

Hello, 

 

I am trying to create a DAX mesaure that will show the accumnulated total of a balance sheet line item using th GL data. I have created the following measure that pulls the accumulated balance for the last transaction for that period using the MAX index. 

 

The measure I have is as follows: 

BalanceCheck = CALCULATE(
SUM('tGL Combined'[Balance]),
FILTER('tGL Combined','tGL Combined'[Index]=max('tGL Combined'[Index]))
)
The problem I am having is that the visual looks choppy because the GL data has missing days where there was no transactional data. I want to add an IF Statement that if there is a day with no transactional data it will pull the accumulated balance from the previous day. 
 
Can someone please help me add to my exisitng measure?
 
Thank!
 
 
1 REPLY 1
Nathaniel_C
Community Champion
Community Champion

Hi @Jenn_Hill_13 
Try this: did it free hand, so let me know if you have any issues. Using the Index to go back 1 row.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel


BalanceCheck =

VAR _presIndex = 'tGL Combined'[Index]

VAR _prevIndex = 'tGL Combined'[Index] - 1

VAR _presCalc =
    CALCULATE (
        SUM ( 'tGL Combined'[Balance] ),
        FILTER ( 'tGL Combined', 'tGL Combined'[Index] = MAX ( 'tGL Combined'[Index] ) )
    )
VAR _prevCalc =
    CALCULATE (
        SUM ( 'tGL Combined'[Balance] ),
        FILTER ( 'tGL Combined', 'tGL Combined'[Index] = prevIndex )
    )
RETURN
    IF ( _presCalc = 0, _prevCalc, presCalc )


 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.