cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Conditional formatting for multiple columns with text values and numbers

Hello everyone.

 

I'm quite new in Power Bi and trying to get one type of formatting working.

I have a table with 10K+ rows and around 30+ columns. Most of the columns are week of the year, but in month format (Like 7-Jan, 14-Jan, etc). It also means, that report is live and have to be updated every week by refreshing updated data from excel. 

 

I'm putting below a picture with example. 

Row dataRow data

 

 

 

 

Lets say I have ships, which are going to sea from time to time. It's showed by numbers - how many trips they did.

They also go sometimes to sea in repair status, or sitting at dock with repair status. I have "R" for this.

 

I want to highlight all "R"s and also have possibility to sum totals at the right and bottom. 

 

 

2.jpg

 

 

 

 

 

Appreciate any help.

 

 

 

3 REPLIES 3
Highlighted
Super User IX
Super User IX

Re: Conditional formatting for multiple columns with text values and numbers

@ATsyurin , Create a measure like this . And use that with field option under conditional formatting

example

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)

 

refer Color Measure - Conditional formatting
https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Regular Visitor

Re: Conditional formatting for multiple columns with text values and numbers

@amitchandak, thanks for quick reply.

 

Not sure if that measure will help to highlight cells, containing "R". 

All examples in web I saw, contains only 1 column, where cells could be highlighted based on their values. Is there a way to do it for miltiple columns in 1 batch? I have weeks year to date, which will be constantly updated.

 

I have no issues to make this in vba in excel, but moving thisng to PBi create difficulties...

 

Thanks

Highlighted
Super User VI
Super User VI

Re: Conditional formatting for multiple columns with text values and numbers

Your week columns should be unpivoted in your query, and you should add a Date table to your model (if not already).  You can then use the week column from your Date table, and  this would let you apply conditional formatting (SEARCH for "R") to the measure that would go in the values area (as well as more easily do your other analyses).  The matrix would give you your row/column/grand totals.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors