Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help: Conditional Formatting can't work if remove [year] for a Matrix visual

I drag and drop a Matrix into the Page, put [year] from a date table to Rows, and put the following 2 measures to Values.

cntd_dif_ti_CF = [cntd_ti_CY_way2] - [cntd_ti_LY_way2_2]

cntd_ti_indicator = SWITCH(
TRUE(),
[cntd_ti_CY_way2] <= 0, "NA",
[cntd_ti_CY_way2] > [cntd_ti_LY_way2_2],UNICHAR(9650),
[cntd_ti_CY_way2] < [cntd_ti_LY_way2_2],UNICHAR(9660),
                [cntd_ti_CY_way2] = [cntd_ti_LY_way2_2],UNICHAR(9679),
BLANK()
)

 

Then, use the following measure as 'Field value' for conditionally formatting the font color of [cntd_ti_indicator] :

cntd_ind_color = SWITCH(
TRUE(),
[cntd_dif_ti_CF] > 0, "Green",
[cntd_dif_ti_CF] < 0, "Red",
[cntd_dif_ti_CF] = 0, "Blue",
BLANK()
)

 

Now, get:

 

However, if I remove/exclude [year] from Rows (of the Matrix), the conditional formatting can't work, e.g.

 

I just need a single row with green arrow-up for increase or red arrow-down for decrease; I don't want multiple rows (as the top picture). How should I do?

 

  • Hi Anonymous 

     

    I just replicated your data, your issue is cozed when you remove the rows of matrix that leave only values in matrix, which make it not complete.

    I'd suggest you move the column cntd_dif_ti_CF to Rows field:

     

6 Replies

  • v-diye-msft's avatar
    v-diye-msft
    Community Support

    Hi Anonymous 

     

    Could you please kindly share your pbix file that I can check it further? please make sure you've removed the confidential info before sharing. 

    You can upload it to Onedrive/dropbox and share the link here.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      I can't use Onedrive/dropbox…

       

      I simplify the example/problem as follows

      1) Have the dataset like

       

      2) Create 3 matrixes for investigation

      • The right top matrix has [year] in Rows.
      • The right bottom matrix doesn't have [year] in Rows.
      • Both the right top/bottom matrixes have conditional formatting on [cntd_ti_indicator] using [cntd_ind_color] for 'Font color' (formatted by 'Field value').

       

      3) Click a [year] value on the left matrix; no color change for the right bottom matrix, e.g. clicking 2015...

       

      Question:

      I need a single row like the right bottom matrix and also need the color of indicators (arrows) to change according to [cntd_dif_ti_CF] (i.e. if the value of [cntd_dif_ti_CF]  is positive, then green; if it's negative, then red). How should I do? Is this a bug for Power BI?

       

      • v-diye-msft's avatar
        v-diye-msft
        Community Support

        Hi Anonymous 

         

        I just replicated your data, your issue is cozed when you remove the rows of matrix that leave only values in matrix, which make it not complete.

        I'd suggest you move the column cntd_dif_ti_CF to Rows field: