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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Soniar
New Member

Conditional row formatting based on column total by category

Hello,

I would like to create a conditional formatting of my following datas:

Soniar_0-1663745545505.png

The result has to be red color if the % in the row is < of the related colum total. (Ex. for actuators less then 32.57% valve less then 32.15) the values are %tr of sales amount

any idea?

thanks.

Sonia

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Soniar ,

You can first use measure to find the Total value, and then use Value to compare.

In my data, Total represents the average of each group.

vyangliumsft_0-1663819252098.png

Here are the steps you can follow:

1. Create measure.

color =
IF(
    MAX('Table'[Amount])<
 DIVIDE(
SUMX(FILTER(ALL('Table'),'Table'[Group]=MAX('Table'[Group])),[Amount]),
CountX(FILTER(ALL('Table'),'Table'[Group]=MAX('Table'[Group])),[Amount]))
&&HASONEVALUE('Table'[Region])=TRUE()
    ,"red")

2. [Measure] – Conditional formatting – Background color.

vyangliumsft_1-1663819252102.png

 

vyangliumsft_2-1663819252105.png

3. Result:

vyangliumsft_3-1663819252108.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hello Liu,

Thanks for your reply

I followed your instruction but the result is not correct

Soniar_0-1663847269426.png

I created the Measure color as you suggest 

color =
IF(
    MAX('sales_totale'[UBLNAM])<
 DIVIDE(
SUMX(FILTER(ALL('sales_totale'),'sales_totale'[MMITCL]=MAX('sales_totale'[MMITCL])),[UBLNAM]),
CountX(FILTER(ALL('sales_totale'),'sales_totale'[MMITCL]=MAX('sales_totale'[MMITCL])),[UBLNAM]))
&&HASONEVALUE('sales_totale'[OKCUNM])=TRUE()
    ,"red")
I don't know if the problem is due to the fact that family and region are not contained in the same table.
I used MMITCL in the measure that is related to the family table and OKCUNM that is related to the customer table where there is the region.
As you can see in the screenshot the red color is not applied correctly.
thanks
Sonia

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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