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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
PGAT
Helper III
Helper III

IF - Multiple conditions

Hi, I have 3 x columns as condition, and my outcome will be a score number.  I am am new to DAX.  Can someone share with me what is wrong with my formula? No syntax error.  Do I put the score number alone like this if I want to use the score later in charts? Thank you.

 

SCORE.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@PGAT 
You create the column in Query Editor which is M formula. I would recommend you to create a column with DAX not M query. The dax formula is something like:

 

Column = SWITCH(True(),
[BKR TYPE]="KCD" && [JOB TYPE]="OB" && [MODE]="SEA",3,
[BKR TYPE]="KCD" && [JOB TYPE]="OB" && [MODE]="AIR",1.5,
[BKR TYPE]="KCD" && [JOB TYPE]="IB" && [MODE]="SEA",2,
...
...
...)

 


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

@PGAT 
You create the column in Query Editor which is M formula. I would recommend you to create a column with DAX not M query. The dax formula is something like:

 

Column = SWITCH(True(),
[BKR TYPE]="KCD" && [JOB TYPE]="OB" && [MODE]="SEA",3,
[BKR TYPE]="KCD" && [JOB TYPE]="OB" && [MODE]="AIR",1.5,
[BKR TYPE]="KCD" && [JOB TYPE]="IB" && [MODE]="SEA",2,
...
...
...)

 


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks to the both of you. I didn't know the difference between DAX and M. 

 

How do I create the column in DAX?  It seems complicated.  

 

Currently, I tried to add customs column in query editor, and then to work out my IF.  

 

 

Anonymous
Not applicable

@PGAT 

After you close or close&apply from the power query editor. Power bi Desktop is worked with DAX calculation.


dax calculated column.JPG


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi Paul, thanks, I tried but when I try to chart it, I don't see any values come up. Where did I go wrong?  I stopped short of writing more just to see if I am getting it right.  Is DAX case sensitive?

 

DAX Switch.png

Hi @PGAT ,

 

Be sure that you have the column formatted as number.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



 

Thank  you, MFelix. 

MFelix
Super User
Super User

Hi @PGAT ,

 

First of all in Power BI there are the use of two languages DAX (front end) and M language on the query editor, you are showing a query formula so you are using M language.

 

Don't really understand your question, what is going wrong with your data? Be sure to convert this column to number in order to use in charts.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.