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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to Filter multiple text values, with a SWICTH Function in DAX ?

Can someone help me, I don't know how to I apply the filter in this scenario.

Should I use Power Query?

Dental1 = FILTER ('CME 20-22',
'CME 20-22'[Category]="Dentist"&&
'CME 20-22'[Category]="Endodontics"&&
'CME 20-22'[Category]="Forensic odontology"&&
'CME 20-22'[Category]="Oral and maxillofacial surgery"&&
'CME 20-22'[Category]="Oral medicine"&&
'CME 20-22'[Category]="Orthodontics"&&
'CME 20-22'[Category]="Paediatric dentistry"&&
'CME 20-22'[Category]="Periodontics"&&
'CME 20-22'[Category]="Prosthodontics"&&
'CME 20-22'[Category]="Special needs dentistry"

RETURN
IF ('CME 20-22'[Product Class]="Dental Indemnity",
 
SWITCH(TRUE(),
 
'CME 20-22'[Basis]="Dental specialist in training",1,
'CME 20-22'[Basis]="Employer indemnified only",1,
'CME 20-22'[Basis]="Gratuitous services only",1,
'CME 20-22'[Basis]="New graduate",1,
'CME 20-22'[Basis]="Non-practising",1,

0),
0))
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , It should be like

 

Dental1 = if(
'CME 20-22'[Category] in {"Dentist","Endodontics","Forensic odontology","Oral and maxillofacial surgery","Oral medicine","Orthodontics","Paediatric dentistry","Periodontics","Prosthodontics","Special needs dentistry" }
&& 'CME 20-22'[Product Class]="Dental Indemnity",

SWITCH(TRUE(),

'CME 20-22'[Basis]="Dental specialist in training",1,
'CME 20-22'[Basis]="Employer indemnified only",1,
'CME 20-22'[Basis]="Gratuitous services only",1,
'CME 20-22'[Basis]="New graduate",1,
'CME 20-22'[Basis]="Non-practising",1,

0),
0)

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , It should be like

 

Dental1 = if(
'CME 20-22'[Category] in {"Dentist","Endodontics","Forensic odontology","Oral and maxillofacial surgery","Oral medicine","Orthodontics","Paediatric dentistry","Periodontics","Prosthodontics","Special needs dentistry" }
&& 'CME 20-22'[Product Class]="Dental Indemnity",

SWITCH(TRUE(),

'CME 20-22'[Basis]="Dental specialist in training",1,
'CME 20-22'[Basis]="Employer indemnified only",1,
'CME 20-22'[Basis]="Gratuitous services only",1,
'CME 20-22'[Basis]="New graduate",1,
'CME 20-22'[Basis]="Non-practising",1,

0),
0)

Anonymous
Not applicable

Legendary!! Bro!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.