Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Highlight specific rows in a table visual that meets a condition

Hi all: Good day! I have a ‘Summary table’ visual that shows maintenance notice data for different pipelines. It shows pipeline name, event subject, start date, end date, update date, etc. as below

 

I want to highlight those rows that have an update date from yesterday [1 day earlier than today] and beyond. I have created a query,  prevDayFilter

 

I am trying to use updateDate>=prevDayFilter to apply to specific rows that will meet this condition and get it highlighted with a color, say yellow.I have created another query, RowHighlight as

= IF (SELECTEDVALUE(genscape_maintenance_events[updateDate])>=prevDayFilter; 1;0))

As I start applying conditional formatting for each Column in the ‘Table’ visual to have specific rows get highlighted: I get an issue as below: the Based on field shows ‘Count of RowHighlight’ instead of only ‘RowHighlight’ – so it highlights all cells of that column, e.g. PipelineName in yellow rather than only those cells that meet the condition!

 

Any suggestion? Many thanks in advance. 🙂

I followed a post: https://community.powerbi.com/t5/Desktop/highlight-specific-rows-in-matrix/m-p/893600

  • tex628's avatar
    tex628
    6 years ago

    Try wrapping the prevdayfilter column in a selectedvalue(). Even if there is just 1 value and 1 column in a table you still cant refer directly to the table, instead you need to do an aggregation on the column to get the appropriate value. 

    highlightRow = 
    VAR Filter = SELECTEDVALUE( prevDayFilter[Column] )
    Return
    IF (SELECTEDVALUE(genscape_maintenance_events[updateDate]) >= Filter, 1,0)


    / J

  • tex628's avatar
    tex628
    6 years ago

    Just choose select the column you want the table sorted by, then apply either asc or desc sorting:

    Whatever settings you have applied when you publish to Power BI Service will be the default for the users when they access the report. 

    / J

17 Replies

  • Change the summarization type,  or change your measure into a boolean.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi lbendlin: Thanks for your response. How do I change the Summarization type? Here is what I get for selecting the rule:

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi all: Good day. As I tried to make the second query, RowHighlight as having boolean value-  1 [or 0] as below

        = IF (SELECTEDVALUE(genscape_maintenance_events[updateDate])>=prevDayFilter, 1,0))

        i find same issue as stated earlier [Format by  Rules]. Any help will be highly appreciated. 

  • tex628's avatar
    tex628
    Icon for Community Champion rankCommunity Champion

    Hey Anonymous!

    I think you're running an old version of Power BI, notice the differences in layout here:

    My client:


    Yours:

    I think this is the casue of the issue as I can't really see anything wrong with what you've been doing. 

    Let me know how it goes. 

    / J

    • Anonymous's avatar
      Anonymous
      Not applicable

      hi tex628: I got Power BI Desktop Version: 2.78.5740.721in June 2020. Will that make this much difference!? 

      • tex628's avatar
        tex628
        Icon for Community Champion rankCommunity Champion

        I don't know 🙂 But lets make a reverse test.

        I've attached a sample file with the formatting applied, try opening it and check that the formatting is similar to what we're aiming for.

        Then try removing and reapplying the conditional formatting. It should give us an idea if the issue lies with the client or the measure itself. 

        / J

  • v-diye-msft's avatar
    v-diye-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

     

    You might consider providing your dummy pbix that would be helpful for us to investigate it further. 

    You can upload it to the onedrive for business and share the link here. please don't forget to disclose the expected results and remove the confidential info.