Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
vanhell54321
Frequent Visitor

Need help with DAX formula to mark the shape

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

 

NationFruits
1Banana
1Orange
2Banana
3Orange
4Banana
4Orange

 

 

 

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. 


NationFruitsShape
1BananaBoth
1OrangeBoth
2Bananalong
3Orangecircle
4BananaBoth
4OrangeBoth

 

Thanks!

 

Regards,

Van

2 REPLIES 2
Anonymous
Not applicable

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/

 

 

Anonymous
Not applicable

Try something like this

I am not sure this will work or not but give try

Column=
Var check=Calculate(distinctcount(table[fruit]),allexcept(table,table[nation]))
Return
Switch(true(),check=2,
If(table[fruit]="orange","circle","long"),"both")

Thanks,
Pravin

If it resolves your problem mark it as a solution and give Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors