cancel
Showing results for
Did you mean:
Helper II

## Help with measure to see right color when "All" is selected in Slicer

Hi,

When I select a particular country from slicer, I get the correct result as shown below in the pie chart. I have a green and a red option of pie chart similarly and it all works fine. Green is for positive values and Red is for negative values

But when I select "All" from the slicer, I only get blank image as shown below:

I am using the following measures to show green and red. Eaxmple as follows:

Green = IF(([Delta] > [Error Margin]), 1, 0)

I am struggling with writing the measure for that. How can I show a different color instead when "All" is selected, say orange color?

Thanks for the help!

1 ACCEPTED SOLUTION
Community Support

Hi, @kamsingh11

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

You may create measures as below.

``````Green =
IF(
HASONEVALUE('Table'[Country]),
IF(
SUM('Table'[Delta])>SUM('Table'[Error Margin]),
1,0
),
0
)``````
``````Red =
IF(
HASONEVALUE('Table'[Country]),
IF(
SUM('Table'[Delta])<=SUM('Table'[Error Margin]),
1,0
),
0
)``````
``````Orange =
IF(
HASONEVALUE('Table'[Country]),
0,
1
)``````

Result:

Best Regards

Allan

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

4 REPLIES 4
Community Support

Hi, @kamsingh11

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

You may create measures as below.

``````Green =
IF(
HASONEVALUE('Table'[Country]),
IF(
SUM('Table'[Delta])>SUM('Table'[Error Margin]),
1,0
),
0
)``````
``````Red =
IF(
HASONEVALUE('Table'[Country]),
IF(
SUM('Table'[Delta])<=SUM('Table'[Error Margin]),
1,0
),
0
)``````
``````Orange =
IF(
HASONEVALUE('Table'[Country]),
0,
1
)``````

Result:

Best Regards

Allan

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

Helper II

Thank you so much! I never used HASONEVALUE before. This will be handy for sure!

Memorable Member

The Card color depends on the name of the country right? if so then you would want to use SWITCH formula.

What are those measures [Delta] , [Error Margin] ?

Regards
Amine Jerbi

Helper II

color card depends on the values represented by Green and Red measures for the selected country. There are several countries. When we select a particular country, color shown by Green and Red measures are fine. But when "All" in Country slicer is selected, the color card becomes blank and I would like it to be some color by creating a new measure that represents "All" in the slicer.

Announcements

#### Happy New Year from Power BI

This is a must watch for a message from Power BI!