March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I need help with writing a dax to return a true or false if a value is found in the column after it was filtered by job number
eg: the value to be looked for is red
It's supposed to return true for job number 1 since red is in the second row. For job 2 and 3 it returns false because red is nowhere in the colour column for these job numebrs
job number | colour | true/false |
1 | blue | true |
1 | red | true |
1 | orange | true |
2 | yellow | false |
2 | black | false |
3 | white | false |
3 | pink | false |
3 | brown | false |
Solved! Go to Solution.
@Anonymous ,
There are a few different ways this could be done. But I would simply change the IF to a SWITCH function:
True/False2 =
VAR _Currentjobnumber = [job number]
VAR _Colour = SUMMARIZE( FILTER( Colour, Colour[job number] = _Currentjobnumber), Colour[colour])
VAR _Result = SWITCH(
TRUE(),
"red" in _Colour, "True",
"gray" in _Colour, "True",
"False" )
RETURN
_Result
The SWITCH is similar to a nested IF, allows for multiple conditions but is much cleaner and easier to read.
Now you can add as many colours as you need.
Regards,
@Anonymous ,
There are a few different ways this could be done. But I would simply change the IF to a SWITCH function:
True/False2 =
VAR _Currentjobnumber = [job number]
VAR _Colour = SUMMARIZE( FILTER( Colour, Colour[job number] = _Currentjobnumber), Colour[colour])
VAR _Result = SWITCH(
TRUE(),
"red" in _Colour, "True",
"gray" in _Colour, "True",
"False" )
RETURN
_Result
The SWITCH is similar to a nested IF, allows for multiple conditions but is much cleaner and easier to read.
Now you can add as many colours as you need.
Regards,
@Anonymous .
Please try the following as a Calculated Column:
True/False =
VAR _Currentjobnumber = [job number]
VAR _Colour = SUMMARIZE( FILTER( Colour, Colour[job number] = _Currentjobnumber), Colour[colour])
RETURN
IF( "red" IN _Colour, "True", "False" )
job number | colour | True/False |
1 | blue | True |
1 | red | True |
1 | orange | True |
2 | yellow | False |
2 | black | False |
3 | white | False |
3 | pink | False |
3 | brown | False |
Regards,
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |