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
zuro16
Helper I
Helper I

Assign legend "low margin" based on margin percentage per order type

I have three order types based on "order" being with external customer (order type ZS02) or internal customer (order types ZS03, ZS04). I'd like to assign the legend "low margin" ( on new column) based on thresholds defined per the order types. The thresholds are 12% or less than 12% for order typeZS02, 7.5% or less for order type ZS03, and 6.4% or less for order type ZS04. Below a mock table of the final -desired- output ( last column would be the column with the legend). How can this be accomplished

 

OrderOrder TypeMarginText assignment ( New column)
azs0215% 
bzs032%Low Margin
czs043%Low Margin
dzs039% 
ezs0410% 
fzs0210%Low Margin
gzs034%Low Margin
hZS0216% 
iZS045%Low Margin
1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member

@zuro16 

 

Are you trying to create the new column(4th col) in the mockup?

 

Try this as a calculated column

Column = SWITCH(TRUE(),
'Table (2)'[Order Type] = "zs02" && 'Table (2)'[Margin] <=0.12,"Low Margin",
'Table (2)'[Order Type] = "zs03" && 'Table (2)'[Margin] <=0.075,"Low Margin",
'Table (2)'[Order Type] = "zs04" && 'Table (2)'[Margin] <=0.064,"Low Margin",
BLANK())

 

image.png

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

View solution in original post

3 REPLIES 3
VasTg
Memorable Member
Memorable Member

@zuro16 

 

Are you trying to create the new column(4th col) in the mockup?

 

Try this as a calculated column

Column = SWITCH(TRUE(),
'Table (2)'[Order Type] = "zs02" && 'Table (2)'[Margin] <=0.12,"Low Margin",
'Table (2)'[Order Type] = "zs03" && 'Table (2)'[Margin] <=0.075,"Low Margin",
'Table (2)'[Order Type] = "zs04" && 'Table (2)'[Margin] <=0.064,"Low Margin",
BLANK())

 

image.png

 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

@VasTg  What if one the lines is negative (less than 0 <zero>) on the planned margin ( on any of the order types), and instead of returning the legend "low margin", I'd like to get the word "Negative margin", but -still- I'd like to keep the "low margin" on those above 0 (zero) margin? is this something we can build on top of the formula you've suggested or this would be an entirely different formula? Thank you, Carlos.

Thanks much VasTg!

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.