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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
dwauer
Frequent Visitor

Coloring rows based on values in other rows

Hello Friends,

 

I am new to power bi and i tried to search first for my problem, but couldn't found something to solve.

 

I want color the whole row based on values in one column.

 

Example:

 

dwauer_0-1709553068917.png

 

In first column i have different values like FGEFA2400058 or FGEFA2400864.

I need different color only if value changes.

If values is equal then choose same color for this value.

 

Can somebody help me please?

Thanks very much!

 

Best regards

Daniel

1 ACCEPTED SOLUTION
v-xuxinyi-msft
Community Support
Community Support

Hi @dwauer 

 

You can try the following steps:

 

1. Add an index column to a table in the Power Query.

vxuxinyimsft_0-1709606054324.png

 

If the index column is not added, the effect in the table visualization is shown below.

vxuxinyimsft_1-1709606163643.png

 

2. Create several measures as follow:

Measure = 
VAR _t = ADDCOLUMNS('Table', "Group", RANKX(ALL('Table'), [ID], [ID], ASC, Dense))
RETURN
SUMX(_t, [Group])

 

formatting = IF(ISODD([Measure]), "orange", "grey")

 

3. Make the Conditional Formatting settings as shown here.

vxuxinyimsft_2-1709606297189.png

 

vxuxinyimsft_3-1709606319636.png

 

Output:

vxuxinyimsft_4-1709606345244.png

 

Best Regards,
Yulia Xu

 

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

View solution in original post

3 REPLIES 3
dwauer
Frequent Visitor

Thanks for your help!

 

I tried the second tip from Yulia and it works but with one error 😉

 

dwauer_0-1709621304333.png

 

Why does FGEFA2401038 and FGEFA2401059 have same "grey" color? There are in different rows and the should not group together.

 

And is it possible to color the whole row?

 

Thanks for your advice!

v-xuxinyi-msft
Community Support
Community Support

Hi @dwauer 

 

You can try the following steps:

 

1. Add an index column to a table in the Power Query.

vxuxinyimsft_0-1709606054324.png

 

If the index column is not added, the effect in the table visualization is shown below.

vxuxinyimsft_1-1709606163643.png

 

2. Create several measures as follow:

Measure = 
VAR _t = ADDCOLUMNS('Table', "Group", RANKX(ALL('Table'), [ID], [ID], ASC, Dense))
RETURN
SUMX(_t, [Group])

 

formatting = IF(ISODD([Measure]), "orange", "grey")

 

3. Make the Conditional Formatting settings as shown here.

vxuxinyimsft_2-1709606297189.png

 

vxuxinyimsft_3-1709606319636.png

 

Output:

vxuxinyimsft_4-1709606345244.png

 

Best Regards,
Yulia Xu

 

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

PijushRoy
Super User
Super User

Hi @dwauer 

Create a measure like below and apply background color for each field

 

Measure 2 = IF(
    SELECTEDVALUE('Product Lookup'[product_group]) IN {"Food","Add-ons"},"Yellow","skyblue")

 

 

PijushRoy_0-1709553713972.png

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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