Forum Discussion
two or more IF conditions
- 3 years ago
EDIT: in Power Query I've made it now that way as an example:
Hi Tim,
let's start with basics - Power Query and DAX are two different languages and thus have a different syntax.
This is the M query reference (Power Query): Operators - PowerQuery M | Microsoft Learn for all the various operators. As you can see the logical and is just "and"
For DAX the reference is here: DAX operators - DAX | Microsoft Learn and you can see that the logical and has a syntax of "&&"
Also in your problem description I think you're mixing up rows with columns.
The correct syntax in your case would be:
My New Column = SWITCH(TRUE(),
'MyTable'[Age] > 10 && 'MyTable'[Age] <= 20, "Between 10-20",
'MyTable'[Age] > 20 && 'MyTable'[Age] <= 30, "Between 20-30",
"Other")
- DerMainzer3 years ago
Resolver I
Hey,
thanks for the quick response. You're right, I need to get to the basics, I've just started to learn Power BI and I'm on my own. I have an offer for a project in 3-4 months and if I tell them I'm not able to they'll then take another one, but that's another story !
UnfortunatelyI can't make your solution work: This is the table (I changed it to fit your code):
If I add a new measure it tells me:
Cannot find a single value for column 'Age' in table 'MyTable'. This can happen when a MEasure formula refers to a column with many values without an aggregation like MIN, MAX, Count...Regards,
Tim