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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
adinh1
Regular Visitor

Switch statement with fields and not measures

Hi, I am trying to create a switch statement using table fields and and not measaures.

 

Something like:

Category = 
SWITCH(SelectedValue('Table A'[Category] = "Red"),
'Table A'[RedItems], 'Table A'[OtherItems])

4 REPLIES 4
DataNinja777
Super User
Super User

Hi @adinh1 

Something like below (depending on the field names in your data model) should work.  

Sakiko_0-1693948230458.png

 

Hi Sakiko, thanks for the help, but the problem is that Reditems and Otheritems are actually fields within the same table. (Table A)

Hi @adinh1 

 

Are Reditems and Otheritems mutually exclusive (i.e., there are no overlaps)?  In that case, why do you need to separate those out in two columns and not combine in one field?  

Other items has values that is diff than red items in my case and we want to display both the unique values. For example Red needs to show it's own and Others need to show theirs.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.