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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Nested IF condition with ISFILTERED function.

I All,
I have written DAX code like this: -

Measure = if(

ISFILTERED('optimisation'[BROADCASTER]),CALCULATE(DIVIDE ( [1], [2] ),

ALL('optimisation'[LEVEL]),'optimisation'[LEVEL] = "BROADCASTER"),

 

if(ISFILTERED('optimisation'[BROADCASTER]) && ISFILTERED(

'optimisation'[SERIES]),CALCULATE(DIVIDE ( [1], [2] ),

ALL('optimisation'[LEVEL]),'optimisation'[LEVEL] = "SERIES")))

But when I select any broadcaster from broadcaster filter its perfectly working but my second "If" condition fail when I select series from the filter it gives me a blank on card.




1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try below code:-

Measure =
VAR _series =
    CALCULATE (
        DIVIDE ( [1], [2] ),
        ALL ( 'optimisation'[LEVEL] ),
        'optimisation'[LEVEL] = "SERIES"
    )
VAR _broadcaster =
    CALCULATE (
        DIVIDE ( [1], [2] ),
        ALL ( 'optimisation'[LEVEL] ),
        'optimisation'[LEVEL] = "BROADCASTER"
    )
RETURN
    IF (
        ISFILTERED ( 'optimisation'[SERIES] ),
        IF ( ISFILTERED ( 'optimisation'[BROADCASTER] ), _series ),
        IF ( ISFILTERED ( 'optimisation'[BROADCASTER] ), _broadcaster )
    )

 

Thanks,

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

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try below code:-

Measure =
VAR _series =
    CALCULATE (
        DIVIDE ( [1], [2] ),
        ALL ( 'optimisation'[LEVEL] ),
        'optimisation'[LEVEL] = "SERIES"
    )
VAR _broadcaster =
    CALCULATE (
        DIVIDE ( [1], [2] ),
        ALL ( 'optimisation'[LEVEL] ),
        'optimisation'[LEVEL] = "BROADCASTER"
    )
RETURN
    IF (
        ISFILTERED ( 'optimisation'[SERIES] ),
        IF ( ISFILTERED ( 'optimisation'[BROADCASTER] ), _series ),
        IF ( ISFILTERED ( 'optimisation'[BROADCASTER] ), _broadcaster )
    )

 

Thanks,

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

Anonymous
Not applicable

@Samarth_18 Thanks its working.. 😊

amitchandak
Super User
Super User

@Anonymous , for second one both should be filtered and you need to have some data for 'optimisation'[LEVEL] = "SERIES"

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak HI Thanks for your reply, I tested my measure i selected first broadcaster then series in filter while selecting series in filter card showing me the "Blank".
I created separate measure for series and tested my values,
Selecting broadcaster then series it works for me

Measure 2 = if(ISFILTERED('optimisation'[BROADCASTER]) && ISFILTERED(
'optimisation'[SERIES]),CALCULATE(DIVIDE ( [1], [2] ),
ALL('optimisation[LEVEL]),'optimisation'[LEVEL] = "SERIES"))
But in nested if condition it is not working.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.