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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jitpbi
Post Patron
Post Patron

Fill button colour based on field value

Hi,

 

I have to show Equipment's current status by 3 different colours, using button, based on current status field's value:

 

EquipmentCurrent Status
Amp1Healthy
Amp2Anomaly
Amp3Prolonged Anomaly
Amp4 Anomaly
Amp5 Healthy
Amp6 Healthy

 

The colours would be like: Green colour for Healthy, Red colour for Anomaly and Yellow colour for Prolonged Anomaly.

I will use a button for each equipment and fill colour based on the current status.

 

Thanks,

 

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @jitpbi 

 

You may create a measure like below and make 'Equipment' column conditional formatting based on the measure.

Measure = 
SWITCH(
    SELECTEDVALUE('Table'[Current Status]),
    "Healthy","Green",
    "Anomaly","Red",
    "Prolonged Anomaly","Yellow"
)

 

b3.png

 

You may create buttons for each equipment and then create a bookmark for each button's  action setting. You can decide which report element to display and which filters to be applied in the bookmark.

b2.png

 

Finally you may set the action setting for specific button as below.

b5.png

 

When you create a bookmark, the following elements are saved with the bookmark:

  • The current page
  • Filters
  • Slicers, including slicer type (for example, dropdown or list) and slicer state
  • Visual selection state (such as cross-highlight filters)
  • Sort order
  • Drill location
  • Visibility of an object (by using the Selection pane)
  • The focus or Spotlight modes of any visible object

 

For further information, please refer to the document .

 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Allan,

 

Thanks for the comment and your suggested solution.

I have to present like below visual where colours should be represent by buttons for each equipment (e.g. ICR2-POA,ICR4-POA.....) but it is not possible as we can't apply filter on buttons for equipment. Here, I have used card and applied background condition formatting but the problem here is the size of the card is bit larger than buttons. 

So, still looking if these cards can be replaced by buttons.

 

jitpbi_0-1596612564285.png

 

 

 

 

thanks

 

harshnathani
Community Champion
Community Champion

Hi @jitpbi ,

 

See if this video helps.

 

https://www.youtube.com/watch?v=0m-PCX1uCG4

 

Regards,

Harsh Nathani

amitchandak
Super User
Super User

@jitpbi , if you want to color in matrix/table/ display it is possible. But if you want in slicer it is not.

 

You can create a measure like give below and use that in conditional formatting with "field" option.

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"
)

 

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

 

You can check the custom filter for slicer

https://appsource.microsoft.com/en-us/marketplace/apps?product=power-bi-visuals

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi,

 

Thank you for the solution.

 

I have used the below measure:

 

Colour = SWITCH(
                              TRUE(),
                              FIRSTNONBLANK('Button Colour'[Current Status],"NA")="Healthy","green",
                              FIRSTNONBLANK('Button Colour'[Current Status],"NA")="Anomaly","orange",
                              FIRSTNONBLANK('Button Colour'[Current Status],"NA")="Prolonged Anomaly","yellow")
 
I am using button to show the colour but here i am not able to apply filter on equipment field. So, if i want to use a button for each  different equipment then how to achieve it.
 
Thanks,

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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