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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ChrisMcHugh
Helper I
Helper I

Use an IF on a column containing string value that if it returns true, returns a number

IF(AND(AND(AND(AND(VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] = "LOADED", (VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS]) <> "PARTIALLY LOADED"), (VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS]) <> "FAILED"), (VW_STAGING_TO_ACQ_LOAD_DETAIL[TABLE_NAME]) = "ROUTES"), 0)))
 
This above code will not work for me as I need a function between the last AND and VW_STAGING_TO_ACQ_DETAILS. Any function I use does not wield the correct results
9 REPLIES 9
Samarth_18
Community Champion
Community Champion

Hi @ChrisMcHugh ,

If I took your question correctly then I think you could try below code:-

IF (
    VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] = "LOADED"
        && VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] <> "PARTIALLY LOADED"
        && VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] <> "FAILED"
        && VW_STAGING_TO_ACQ_LOAD_DETAIL[TABLE_NAME] = "ROUTES",
    0
)

 

BR,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi Samarth,

 

Yes it is along those lines for definite. However, upon trying your code, this is the error I am getting.

 

ChrisMcHugh_0-1654688883882.png

 

Is there any way to work around this as I am directly pulling from a column in a dataset

@themistoklis 

 

It is in a column yes

@ChrisMcHugh Please update it as:-

IF (
    MAX ( VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] ) = "LOADED"
        && MAX ( VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] ) <> "PARTIALLY LOADED"
        && MAX ( VW_STAGING_TO_ACQ_LOAD_DETAIL[LOAD_STATUS] ) <> "FAILED"
        && MAX ( VW_STAGING_TO_ACQ_LOAD_DETAIL[TABLE_NAME] ) = "ROUTES",
    0
)

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi @Samarth_18 upon further investigation, I realised this is not quite the solution as it does not return the true value for me, essentially what I have is set it to 0 and then I have formatted a button so that if the measure is 0, to colour the button green yet it is leaving the colour blank and when I set 0 as the false expression also, it then colours the button, I do not think it is reading the max correctly, I am unsure though

@ChrisMcHugh you could break down the measure and return the required value, to check if we are getting expected values or not. or you could share your PBIX file after removing sensitive data.

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi @Samarth_18 Yes I have broken down the measure and only set one condition on it in an attempt to return the desired outcome but no luck as of yet

Hi, @ChrisMcHugh 

If the problem persists, please provide your demo for further research.

Best Regards,
Community Support Team _ Eason

Yes it seems to be working to some extent! I will have to nest IF and IFELSE for different conditions but the basics of it are correct, thank you

Helpful resources

Announcements
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.

Top Kudoed Authors