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
Jackbaz99
Helper I
Helper I

How to have all selected in a switch function

Hi, i have the code below and was wondering how to have it so if "all" were selected on the filter it would show another value?

Really stuck on this one.

Calc Rework Target = 
SWITCH( TRUE(),
"A P" in allselected('Index_Part Information'[Additional_Field_2]) , 1000 ,
"AP Jet" in allselected('Index_Part Information'[Additional_Field_2]) , 150 ,
"SSO" in allselected('Index_Part Information'[Additional_Field_2]) , 500 ,
"LMT" in allselected('Index_Part Information'[Additional_Field_2]) , 500 )
1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @Jackbaz99 ,

 

You may try this Measure.

Rework Target =

VAR Table_ =

    ADDCOLUMNS (

        'Index_Part Information',

        "Target",

            SWITCH (

                TRUE (),

                "A P" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 1000,

                "AP Jet" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 150,

                "SSO" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 500,

                "LMT" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 500,

                ISBLANK ( SELECTEDVALUE ( 'Index_Part Information'[Additional_Field] ) ), 0

            )

    )

RETURN

    SUMX ( Table_, [Target] )

 

Then, the result will look like this.

vcazhengmsft_0-1645684620025.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

2 REPLIES 2
v-cazheng-msft
Community Support
Community Support

Hi @Jackbaz99 ,

 

You may try this Measure.

Rework Target =

VAR Table_ =

    ADDCOLUMNS (

        'Index_Part Information',

        "Target",

            SWITCH (

                TRUE (),

                "A P" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 1000,

                "AP Jet" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 150,

                "SSO" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 500,

                "LMT" IN ALLSELECTED ( 'Index_Part Information'[Additional_Field] ), 500,

                ISBLANK ( SELECTEDVALUE ( 'Index_Part Information'[Additional_Field] ) ), 0

            )

    )

RETURN

    SUMX ( Table_, [Target] )

 

Then, the result will look like this.

vcazhengmsft_0-1645684620025.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Greg_Deckler
Community Champion
Community Champion

@Jackbaz99 Maybe:

Calc Rework Target = 
SWITCH( TRUE(),
COUNTROWS('Index_Part Information') = COUNTROWS(ALL('Index_Part Information')), 999,
"A P" in allselected('Index_Part Information'[Additional_Field_2]) , 1000 ,
"AP Jet" in allselected('Index_Part Information'[Additional_Field_2]) , 150 ,
"SSO" in allselected('Index_Part Information'[Additional_Field_2]) , 500 ,
"LMT" in allselected('Index_Part Information'[Additional_Field_2]) , 500 )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

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

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.