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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
djanszentql
Helper I
Helper I

Conditional formatting matrix table where column/row values are different

I am trying to query multiple servers and return the ipconfig settings of each of our sp_configure settings.  Currently, I have a different connection/query for each server in PBI and I do an "append" in Power Query to put everything into a single table.

 

I want to highlight entire rows where the values in the columns do not match one another.

 

Again, my data is all in a single table where I am pivoting on the "Server" column.  

 

ipconfigpbiissue.png

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@djanszentql it is really great question and here is the solution, I broken down the measures in small pieces to easily understand the solution, ofcourse all this can be done in one measure as well, there are 5 measure and final KPI Color measure return the color which will be used to highlight the row

 

Sum of Amount = SUM ( Amount[Amount] ) 

Sum of Servers = 
    CALCULATE ( 
        [Sum of Amount], 
        ALLSELECTED( Amount[Server] ) 
    )

# of servers = 
COUNTROWS ( 
        CALCULATETABLE( 
            VALUES ( Amount[Server] ), 
            ALL ( Amount ) 
        ) 
    ) 

Avg by Server = 
DIVIDE ( 
    [Sum of Servers], 
    [# of servers]
)

KPI Color = 
IF ( [Sum of Amount] <> [Avg by Server], "Red" )

 

On value section, choose drop down menu next to Amount to do the conditioal formatting to use KPI Color measure

 

image.png

 

 

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

12 REPLIES 12
parry2k
Super User
Super User

@djanszentql it is really great question and here is the solution, I broken down the measures in small pieces to easily understand the solution, ofcourse all this can be done in one measure as well, there are 5 measure and final KPI Color measure return the color which will be used to highlight the row

 

Sum of Amount = SUM ( Amount[Amount] ) 

Sum of Servers = 
    CALCULATE ( 
        [Sum of Amount], 
        ALLSELECTED( Amount[Server] ) 
    )

# of servers = 
COUNTROWS ( 
        CALCULATETABLE( 
            VALUES ( Amount[Server] ), 
            ALL ( Amount ) 
        ) 
    ) 

Avg by Server = 
DIVIDE ( 
    [Sum of Servers], 
    [# of servers]
)

KPI Color = 
IF ( [Sum of Amount] <> [Avg by Server], "Red" )

 

On value section, choose drop down menu next to Amount to do the conditioal formatting to use KPI Color measure

 

image.png

 

 

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I would have never figured this out on my own so thank you very much.  

 

You mentioned doing this in one variable.. how could I do that?  I only ask because at the moment this solution only highlights the row with label 'Sum of config_value'.  I would have to duplicate all of those measures for run_value, minimum, and maximum.. which I would obviously prefer not to do only for the sake of cleanliness in my PBI report.  Any further help is much appreciated.

@djanszentql based on you dataset it should work for every row. May be I missed something.  You don't need to calculate it for every row.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Perhaps I am confused what you meant by [Amount].  I used [config_value] column in place of [Amount].  Here is the dataset.  Just imagine everything censored by the red block is 'Server 1'.  If you were to scroll further down you would eventually see 'Server 2' and so on.

 

Untitled.png

 

@djanszentql perfect what you did to replace Amount wiht your own field, and you don't need to create seperate measure, it will work for each row in your model.  Solution is global to your dataset until you see it is not working



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@djanszentql sorry I got it what you mean, let me send your single measure for all this. sorry for the confusion.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@djanszentql here you go, single measure except # of Server count is kept seperate since that will be used in all the measures

 

KPI Color Single Measure = 
VAR __sumofAmount = SUM ( Amount[Amount] )
VAR __sumofServers =  
CALCULATE ( 
        SUM( Amount[Amount] ), 
        ALLSELECTED( Amount[Server] ) 
    )
VAR __avgbyServer = 
DIVIDE ( 
    __sumofServers, 
    [# of servers]
)
RETURN
IF ( __sumofAmount <> __avgbyServer, "Red" )

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@djanszentql amount would be config_value, run_value, maximum and minimum, so you will have four measure for each column and replace amount with these columns in your measure. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

ahh okay perfect.  Thank you so much!  

@djanszentql awesome. Good luck. Kudos help 😁😉



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Sorry, but I am still confused what Amount[Amount]  is suppose to be?  As in, what column are you referring to when you specify [Amount]?

No need to apologize.  I appreciate the help.  You can just call the table 'Query1' by the way.  I have not renamed it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.