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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
NJCLIFFORD
Frequent Visitor

Conditionally change colour of CARD

Howdy,

 

I have needed to change the colour of the field value in a CARD, which I know cannot be done at the moment. I downloaded the vizualisation 'Advance Card' which enables this to be done. Had it working and published, on the browser works perfectly. As I change filters, it changes from red to green as expected.

 

Now, when I download the PBIX file, and I select the field in Power BI Desktop, the highlighted vizualisation is the Card. I have the Advance Card installed and can see it on the list, but the field when selected highlights the Card icon. Also, when I look at Visual / Callout Value for the card under Color it just has the dropdown option for colour, and is defaulted to red (as default filter sets it to red). When I change the filter in Desktop, the colour changes to green as expected. Change again, goes back to red. 

 

The minute I click on the color dropdown box, when I change the filter it now does not change.....

 

Can someone explain what I am doing wrong??  Is ADvance Card the only 'easy' way to change the colour of a value??

 

Thanks


Nick

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@NJCLIFFORD,

 

You can achieve this with the native Card visual by using the measure below (use color codes or names):

 

Color Format = 
VAR vAmount = [Amount]
VAR vResult =
    SWITCH (
        TRUE,
        vAmount > 0, "Green",
        vAmount = 0, "Yellow",
        vAmount < 0, "Red"
    )
RETURN
    vResult

 

In the Card formatting options, set conditional formatting:

 

DataInsights_0-1663787414575.png

 

DataInsights_1-1663787428521.png

Result:

 

DataInsights_2-1663787448446.png

---

DataInsights_3-1663787471626.png

---

DataInsights_4-1663787489366.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@NJCLIFFORD,

 

You can achieve this with the native Card visual by using the measure below (use color codes or names):

 

Color Format = 
VAR vAmount = [Amount]
VAR vResult =
    SWITCH (
        TRUE,
        vAmount > 0, "Green",
        vAmount = 0, "Yellow",
        vAmount < 0, "Red"
    )
RETURN
    vResult

 

In the Card formatting options, set conditional formatting:

 

DataInsights_0-1663787414575.png

 

DataInsights_1-1663787428521.png

Result:

 

DataInsights_2-1663787448446.png

---

DataInsights_3-1663787471626.png

---

DataInsights_4-1663787489366.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.