Forum Discussion
Alternate matrix row colors
- 3 years ago
Sorry, I don't have Report Server installed, so I cannot test it. Maybe try on the Report Server forum?
https://community.powerbi.com/t5/Report-Server/bd-p/ReportServer
- 3 years ago
ok. very Big thanks for you help.
Thank you for your reply. I have 2 question plz :
1- how to assign CF measure to my matrix?
2- the list IN { "Bi & Data", "Business Consulting", "Infrastructure" } can grow or shrink depending on what is going to be in the database. is it possible to make this line of script dynamic?
thanks in advance
1. The CF measure is a conditional formatting measure, so add it to the measure in the matrix.
2. First of all, I have set up dimension tables for the different fields.
Instead of hardcoding the values, you can include a rank measure together with the ISEVEN function to colour the even rows in one colour and the odd rows another colour in the CF measure as follows:
CF =
VAR _Rnk =
IF (
ISBLANK ( [SUM Sales] ),
BLANK (),
CALCULATE (
RANKX ( ALLSELECTED ( 'Pr Offer Table' ), [SUM Sales],, DESC ),
ALLEXCEPT ( Data, 'Pr Offer Table'[Pr offer] )
)
)
RETURN
IF (
NOT ISINSCOPE ( 'Pr Offer Table'[Pr offer] ),
"White",
IF (
NOT ISINSCOPE ( Data[Year - Month] ),
"White",
IF (
AND ( ISINSCOPE ( 'Pr Offer Table'[Pr offer] ), ISEVEN ( _Rnk ) ),
"#EFB5B9",
"#A0D1FF"
)
)
)
Sort the matrix by sales in descending order and you will get:
Sample PBIX file attached
- PaulDBrown3 years ago
Community Champion
Sorry, I don't have Report Server installed, so I cannot test it. Maybe try on the Report Server forum?
https://community.powerbi.com/t5/Report-Server/bd-p/ReportServer
- David233 years agoFrequent Visitor
in my Power Bi Desktop RS, the CF variable is grayed out, I can't select it :
- David233 years agoFrequent Visitor
ok. very Big thanks for you help.
- David233 years agoFrequent Visitor
I increased the measure in the conditional formatting. but the display is not at the top :
here is the script used :
Me_CF2 = VAR _Rnk = IF ( ISBLANK ( [S-Revenue_actual] ), BLANK (), CALCULATE ( RANKX ( ALLSELECTED ( DIM_PRODUCT ), [S-Revenue_actual],, DESC ), ALLEXCEPT ( DIM_PRODUCT, DIM_PRODUCT[pr_offer] ) ) ) RETURN IF ( NOT ISINSCOPE ( DIM_PRODUCT[pr_offer] ), "White", IF ( NOT ISINSCOPE ( Dim_Time[Period] ), "White", IF ( AND ( ISINSCOPE ( DIM_PRODUCT[pr_offer] ), ISEVEN ( _Rnk ) ), "#EFB5B9", "#A0D1FF" ) ) )