The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
Solved! Go to Solution.
@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.
@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.
After you close or close&apply from the power query editor. Power bi Desktop is worked with DAX calculation.
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?
Hi @PGAT ,
Be sure that you have the column formatted as number.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português
Thank you, MFelix.
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsUser | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
93 | |
51 | |
51 | |
46 |