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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rjg2g11
Advocate I
Advocate I

SWITCH Measure with two visual level filters with multiple data sources

Hello, 

 

I have two visual level filters for two different levels - for example; 

 

Filter 1        Filter 2

1                  11

2                  12

3                  13

                    22

                    23

 

When you filter on 1 on Filter 1, it will bring back 11, 12, 13 - 2 on Filter 2 will bring back 22, 23 etc

 

When i have Filter 1 Selected and then Filter 2 selected to bring back data for 22, for example, the data shows data for 2

 

My code is; 

 

VAR Filter1 =
    IF (
        HASONEVALUE ( 'Filter_Lookup'[Channel] ),
        VALUES ( 'Filter_Lookup'[Channel] ),
        BLANK ()
    )
VAR Filter2 =
    IF (
        HASONEVALUE ( 'Filter_Lookup_Team'[Team] ),
        VALUES ( 'Filter_Lookup_Team'[Team] ),
        BLANK ()
    )

RETURN
    SWITCH (
        TRUE (),
        Filter1 = "1", CALCULATE (
            SUM ( Target_Output[Value] ),
            FILTER ( Target_Output, Target_Output[Channel] = "KA" ),
            FILTER ( Target_Output, Target_Output[Type] = "NSV" )
        ),
        Filter1 = "2", CALCULATE (
            SUM ( Target_Output[Value] ),
            FILTER ( Target_Output, Target_Output[Channel] = "Vape" ),
            FILTER ( Target_Output, Target_Output[Type] = "NSV" )
        ),
        Filter2 = "22", CALCULATE (
            SUM ( Target_Output[Value] ),
            FILTER ( Target_Output, Target_Output[Channel] = "22" ),
            FILTER ( Target_Output, Target_Output[Type] = "NSV" )
        ),
        Filter2 = "23", CALCULATE (
            SUM ( Target_Output[Value] ),
            FILTER ( Target_Output, Target_Output[Channel] = "23" ),
            FILTER ( Target_Output, Target_Output[Type] = "NSV" )
        ), BLANK())

Is there a way when i select something from Filter2, the pre selection of Filter1 can be ignored? I have tired ALL(), ALLEXCEPT() etc etc

 

 

Many Thanks

 

1 REPLY 1
Anonymous
Not applicable

Hi @rjg2g11,

 

Switch function not support to calculate with summarize records or split result based on category. (For your scenario, it will check all cases which you list and return the first matched condition)

 

In addition, if you can please share some sample data for test.

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.