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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ellac
Helper III
Helper III

Wrong total when combining two measures based on IF condition

Hi!

 

I'm trying to combine to measures - Measure 1 Measure 2 - based on what date it is. This is Measure 3. I want to show Measure 1's value for the days up until today, and Measure 2's value for today and forward. My current solution gives med the wrong total.

 

My DAX code right now: 

Measure 3=
IF(
    MAX([DATE]) < TODAY(),
    [MEASURE 1],

    [MEASURE 2]
)

ellac_3-1645520588808.png

As you can see I get the same total for Measure 3 as Measure 2. It should be 51, not 76.

FYI, I only have data in my columns to create Measure 1 and Measure 2 as they are in the picture.

 

Any ideas on what to do?

 

/Ella

 

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

MyMeasure :=
VAR MyTable =
    SUMMARIZE(
        'Table',
        'Table'[DATE],
        "Value", IF( 'Table'[DATE] < TODAY(), [MEASURE 1], [MEASURE 2] )
    )
RETURN
    IF(
        ISFILTERED( 'Table'[DATE] ),
        IF( MAX( 'Table'[DATE] ) < TODAY(), [MEASURE 1], [MEASURE 2] ),
        SUMX( MyTable, [Value] )
    )

 

Regards

View solution in original post

3 REPLIES 3
Jos_Woolley
Solution Sage
Solution Sage

You're welcome!

Cheers

Jos_Woolley
Solution Sage
Solution Sage

Hi,

 

MyMeasure :=
VAR MyTable =
    SUMMARIZE(
        'Table',
        'Table'[DATE],
        "Value", IF( 'Table'[DATE] < TODAY(), [MEASURE 1], [MEASURE 2] )
    )
RETURN
    IF(
        ISFILTERED( 'Table'[DATE] ),
        IF( MAX( 'Table'[DATE] ) < TODAY(), [MEASURE 1], [MEASURE 2] ),
        SUMX( MyTable, [Value] )
    )

 

Regards

Hi Jos! IT IS WORKING 🙂 Thank you so much for such a quick response!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.