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
Anonymous
Not applicable

swtich 1 green 0 red else blank no color

Hi , 

Can someone please make a formula for me. 

If the calue is 1 then its green, if its 0 then its red. And if none of those are selected nothing shows it blank

KPI value = var color=SELECTEDVALUE([on / off])
return
SWITCH(TRUE(),
    color="green",1,
    color="red",0,
    color= ''blank'',)
   

UNICHAR(11044)


value comminty.PNG
I want his as a big circle, and not in a table for condotional formatting
1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

I didn't find the corresponding unicode for green circle, I inserted blue circle instead.

 

Please add below measure into a card visual.

KPI value =
IF (
    ISFILTERED ( Table1[On/Off] ),
    IF (
        SELECTEDVALUE ( Table1[On/Off] ) = 1,
        UNICHAR ( 128308 ),
        UNICHAR ( 128309 )
    ),
    BLANK ()
)

1.png2.png3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

I didn't find the corresponding unicode for green circle, I inserted blue circle instead.

 

Please add below measure into a card visual.

KPI value =
IF (
    ISFILTERED ( Table1[On/Off] ),
    IF (
        SELECTEDVALUE ( Table1[On/Off] ) = 1,
        UNICHAR ( 128308 ),
        UNICHAR ( 128309 )
    ),
    BLANK ()
)

1.png2.png3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

My fault, I meant just white. That nothing shows at all, just plain white. Then when you click it changes. So the kpi card is just white, when you click on either 0 or 1 the colors will change. 

Hi @Anonymous ,

 

Still use above measure formula, then, turn off "Category Label", and set the color of "Data Label" to be the same as card's background.

1.png

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.