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
Anonymous
Not applicable

Alternating Rows style (in table) based on changes in first field

Hi,

 

I am wondering if it is possible to color rows in a table based on changes in one column (A) like below in Picture 1. Sort of the same as Alternating rows (Picture 2) but the color should not change on each row.

Power BI Example.PNG

 

Has anyone seen something like that? I tried Matrix mode as well but I was not able to get a satisfying result there either.

 


With regards

Micke

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I have solved it!

 

I was struggling with getting the measure updated when I applied a value in my slicers but I finally got past that by using ALLSELECTED.

 

This is my final Measure: MyRank = MOD(RANKX(ALLSELECTED('Efterföljande Kontakt');CALCULATE(MAX('Efterföljande Kontakt'[Ärendenummer]));;ASC;Dense));2)

 

This Measure gives me 0 and 1 and I can then add conditional formatting on all my fields and set a color for 0 and another for 1.

 

My only problem now is that the version of Power Bi Desktop on our server doesn't have the Conditional Formatting functionality!! Robot LOL

 

// Micke

View solution in original post

4 REPLIES 4
Nolock
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

I have a solution for you, but it's a workaround, maybe there is something smarter.

 

I have created a new computer column MyRank which is a RANK on the column Case. And then computed a modulo by 2 -> it means the values alternate between 0 and 1.

To colors: I only know how to format a column conditionally, so I have to repeat this step for every column in my table - how to format conditionally is described on the screenshort Nr. 2.

 

 

Annotation 2019-02-26 140620.jpg

 

Annotation 2019-02-26 140954.jpg

Anonymous
Not applicable

Hi (again) Nolock and everyone else Smiley Happy

 

I finally managed to get the Measure working and it looked promising until I used the slicers, as you can see in the two pictures below it doesnt work.

 

My measure: MyRank = MOD(RANKX(ALL('Efterföljande Kontakt');CALCULATE(MAX('Efterföljande Kontakt'[Ärendenummer]));;ASC;Dense);2) 

 

Power BI Example With MyRank Measure.PNG

 

Feels like everything I try gets hung up on that the measure is not recalculated when I activate a filter, I need the rank to be recalculated with the new slicers sort of. I have also tried to change from DirectQuery to Import and doing some tests on an index column but no luck so far.

 

// Micke

Anonymous
Not applicable

I have solved it!

 

I was struggling with getting the measure updated when I applied a value in my slicers but I finally got past that by using ALLSELECTED.

 

This is my final Measure: MyRank = MOD(RANKX(ALLSELECTED('Efterföljande Kontakt');CALCULATE(MAX('Efterföljande Kontakt'[Ärendenummer]));;ASC;Dense));2)

 

This Measure gives me 0 and 1 and I can then add conditional formatting on all my fields and set a color for 0 and another for 1.

 

My only problem now is that the version of Power Bi Desktop on our server doesn't have the Conditional Formatting functionality!! Robot LOL

 

// Micke

Thanks for the solution - this is helpful. I have found though that it only works when the table is sorted by the column that is used to calculate the measure. If I sort the table by any other column then there is a high chance that adjacent rows will end up being the same colour when they should be different colours. Is there any way to make sure that the measure calculates based on whatever sort order is currently being used?

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.