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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

First part of IF statement being ignored

Hi All,

I have the following measure:

Trading_FEE_Measure_Total = IF(YEAR(SELECTEDVALUE(DateTime_Calendar[Date])) >= 2025,-0.04*[Total cashflow before Fees_TNUoS_CM_Total],

SUMX(SUMMARIZE(R_BATTERY_SITES,R_BATTERY_SITES[SITE_NAME],"Trade fee", IF(R_BATTERY_SITES[SITE_NAME] = "Cowley BESS",SUMX(VALUES(DateTime_Calendar[Date]),[Trading_Fee_Measure_Daily]),[Trading_Fee_Measure_Daily])),[Trade fee]))

When I display this measure it is applying the second half of the IF statement to the entire dataset, rather than having anything that is after 2025  be 4% of Total Cashflow.

In the below image the figures for Trading Fee 2025 are what should be for anything after 2025, then anything before that should be the second half of the if statement.
Mburman07_0-1740668742329.png

 




1 ACCEPTED SOLUTION
johnt75
Super User
Super User

The issue is that there isn't a single value for date when you are grouping by year and month. You can instead check the value of the Year column

Trading_FEE_Measure_Total =
IF (
    SELECTEDVALUE ( DateTime_Calendar[Year] ) >= 2025,
    -0.04 * [Total cashflow before Fees_TNUoS_CM_Total],
    SUMX (
        SUMMARIZE (
            R_BATTERY_SITES,
            R_BATTERY_SITES[SITE_NAME],
            "Trade fee",
                IF (
                    R_BATTERY_SITES[SITE_NAME] = "Cowley BESS",
                    SUMX ( VALUES ( DateTime_Calendar[Date] ), [Trading_Fee_Measure_Daily] ),
                    [Trading_Fee_Measure_Daily]
                )
        ),
        [Trade fee]
    )
)

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

The issue is that there isn't a single value for date when you are grouping by year and month. You can instead check the value of the Year column

Trading_FEE_Measure_Total =
IF (
    SELECTEDVALUE ( DateTime_Calendar[Year] ) >= 2025,
    -0.04 * [Total cashflow before Fees_TNUoS_CM_Total],
    SUMX (
        SUMMARIZE (
            R_BATTERY_SITES,
            R_BATTERY_SITES[SITE_NAME],
            "Trade fee",
                IF (
                    R_BATTERY_SITES[SITE_NAME] = "Cowley BESS",
                    SUMX ( VALUES ( DateTime_Calendar[Date] ), [Trading_Fee_Measure_Daily] ),
                    [Trading_Fee_Measure_Daily]
                )
        ),
        [Trade fee]
    )
)
Anonymous
Not applicable

Thank you! This worked

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors