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
Hydrarian
Helper I
Helper I

Conditional formatting card with filters

Hi, I've a report in which I have few card visuals to display the margins in percentage (see the image below):

 

The margins are calculated as this type of measure: 

 

SP_Margin YTD = CALCULATE(TOTALYTD(([SP_Net amount]-[SP_CostMst+])/ABS([SP_Net amount]),'D - Date'[Date]))
 
But the value displayed is also the result of several (and different) filters applied to the cards (below two example of filters applied to two cards. As you can see the filter on Macrocat changes):
2m.PNG          1m.PNG
The problem is that when I apply the conditional formatting to a card it considers only the measure value and not the filter applied to the card, so for example if I want to visualize the negative margins in red and the positive ones in green it may happend that a negative value could be shown as green because the measure is positive, (but the filter makes it visualize as negative).
Is there a workaround to solve this kind of problem without make different measures with different filters? I would like to maintain this formula as general as possible.
 
 
1 REPLY 1
MFelix
Super User
Super User

Hi  @Hydrarian ,

 

Measure are based in context, this means that the calculation are based on the all the information that you use the visualization, the filters and so on. So if you are making the condititional formating based on your measure should return the correct result.

 

Cabn you provide an example please?

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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.