Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
As the title indicate, I am looking for solutions for creating a custom column using an IF statement based on whether the value of that column matches any values in the providing list.
In SQL, the query is something like:
SELECT count( case when column_a in (101, 133, 150, 168, 199, 323, 456, 888, 999) then 1 else 0)
The screenshot is a simplified approach to describe my question. Please advise how to approach this goal in adding custom column windows. Thank you in advance!
Solved! Go to Solution.
Try usinig List.Contains like this instead.
= if List.Contains({30,40,50}, [age]) then 1 else 0
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@mahoneypat gave a good M version of this.
If you happen to want to do this DAX instead, it would look like this:
IF ( [age] IN { 30, 40, 50 }, 1, 0 )
Try usinig List.Contains like this instead.
= if List.Contains({30,40,50}, [age]) then 1 else 0
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
67 |