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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mmalikisi
New Member

Advanced Conditional formatting in Matrix table

Hi am Marvin, 

Have matrix table with different colour ranking scale  Per Row (Each Row has its own scale). It has been working well in Excel Pivot tables where i apply each row with its own @conditional format  color scale/rule however am trying to apply the same in PowerBI but failing. 

example is as below. I failed to paste background color. so used font color to show different colors. but am interested in  Background colours. 

Any urgent Help will be much grateful. 

 

Color Ranking KeyMetric
8-125-7<-0-4Production
65<0-4Sales
8-114-7<0-3data management
65<0-4Management
54<0-3Stores
210Logistics
432Planning
210Marketing
5-63-4< 0-2Accounting
64-5<0-3Human resource
3 REPLIES 3
mmalikisi
New Member

Hi @v-chenwuz-msft 

 

Many thanks for the help. However you may notice that your using only one scale for all the value fields.

 

Am interested in each Table Row Background color having its own Color scale . and Remember. Have unpivoted my columns. so under Format by Rule based on field, Its brings single field  and yet am interested in giving backgorund color for each Unpivotted fields basing on different color scales. e.g using your example;

 

Assuming ID has this color scales

A001: Red(0 - 2) Yellow (3 - 4) Green (5-6)

A002: Red(0 - 4) Yellow (5 - 6) Green (6-8)

A004: Red(0- 10 ) Yellow (11 - 20) Green (21-30)

Hi @mmalikisi ,

 

Is that the result you want ?

vchenwuzmsft_2-1637313513132.png

 

Code

example value rules =
VAR _s =
    SELECTEDVALUE( 'Table'[ID] )
VAR _r_A001 =
    SWITCH(
        TRUE(),
        [Example value] >= 0
            && [Example value] <= 2, "red",
        [Example value] >= 3
            && [Example value] <= 4, "yellow",
        "green"
    )
VAR _r_A002 =
    SWITCH(
        TRUE(),
        [Example value] >= 0
            && [Example value] <= 4, "red",
        [Example value] >= 5
            && [Example value] <= 6, "yellow",
        "green"
    )
VAR _r_A004 =
    SWITCH(
        TRUE(),
        [Example value] >= 0
            && [Example value] <= 10, "red",
        [Example value] >= 11
            && [Example value] <= 12, "yellow",
        "green"
    )
RETURN
    SWITCH( _s, "A001", _r_A001, "A002", _r_A002, "A004", _r_A004, "BLACK" )

Advance control:

vchenwuzmsft_1-1637313480589.png

Best Regards

Community Support Team _ chenwu zhu

 

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

v-chenwuz-msft
Community Support
Community Support

Hi @mmalikisi,

 

Background color is the same setting as font. Under thr Format of this visual.

vchenwuzmsft_0-1637047738463.png

Advanced controls. Based on field , select the rank measure you created. Then add rules and click ok.

vchenwuzmsft_1-1637047802753.png

I put my pbix file in the end you can refer.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.