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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zzinoun
Resolver I
Resolver I

Filtering background color through measure

Hi,

 

I have a strange issue when trying to apply a conditionnal background color for a button.

 

I created a measure that calculates the sum of a binary column (1 .  0) and returns 1 if the sum is superior to 1 and 0 if not. 

zzinoun_0-1670009697263.png

Currently this column has only "0" so it is obvious to have a "red" Color 

 

However, this is not the case as the button returns light blue as configured for "1" value. And the most interesting part is the measure returns "0" on Card visual. see image below ;

zzinoun_1-1670009856421.png

How that can be possible ?

 

Note that there is currently no filter applied.

 

Thanks .

1 ACCEPTED SOLUTION
zzinoun
Resolver I
Resolver I

The issue has been solved when i removed the measure to the same table where related columns are ! 

I thought the measure is not impacted with where it has been created ....

View solution in original post

6 REPLIES 6
zzinoun
Resolver I
Resolver I

The issue has been solved when i removed the measure to the same table where related columns are ! 

I thought the measure is not impacted with where it has been created ....

That is correct. While measures have a "host table"  that is not relevant for the computations.

 

Don't conflate "table"  and "table visual"  though - these are different concepts.

Yes I know ! but it was the case for me 

If I were you I would not be satisfied with that. There must be a different reason for the observed behavior.

v-rzhou-msft
Community Support
Community Support

Hi @zzinoun ,

 

Please make sure the binary column is a column in your data model. I think [Bg Color DM ET5] should be a easy measure based on binary column with IF function. Here I create a sample to have a test.

RicoZhou_0-1670220022424.png

Measure:

Measure = 
VAR _SUM = CALCULATE(SUM('Table'[binary]))
RETURN
IF(_SUM>1,1,0)

Background setting:

RicoZhou_1-1670220065530.png

Result is as below. It works.

RicoZhou_2-1670220076250.png

RicoZhou_3-1670220113088.png


Best Regards,
Rico Zhou

 

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

 

 

lbendlin
Super User
Super User

This will depend on the filter context that you have imposed on the button.  Please provide more details, or a sample pbix that demonstrates the issue.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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