Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear power BI community,
I have the following columns I need to make a new calculated column using DAX formula.
The following data looks like the below
Nation | Fruits |
1 | Banana |
1 | Orange |
2 | Banana |
3 | Orange |
4 | Banana |
4 | Orange |
I need to create a new column shape that marks orange as circle and Banana as long and if the Nation as both the fruits the column marks it as both.
Nation | Fruits | Shape |
1 | Banana | Both |
1 | Orange | Both |
2 | Banana | long |
3 | Orange | circle |
4 | Banana | Both |
4 | Orange | Both |
Thanks!
Regards,
Van
Hi @vanhell54321 ,
Use the below Dax formula:
Shape =
VAR CountFruits =
CALCULATE ( COUNT ( table[fruit] ), ALLEXCEPT ( table, table[nation] ) )
RETURN
SWITCH (
TRUE (),
CountFruits = 2, IF ( table[fruit] = "orange", "circle", "long" ),
"both"
)
Regards,
Gaurav Raj Singh
LinkedIN : https://www.linkedin.com/in/gauravrajsingh/
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
26 | |
21 | |
16 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |