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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
n00b_90
Frequent Visitor

Conditionally format bar chart by selected value in slicer - if isfiltered

 

Hi Community! 

 

I am trying to highlight a bar when the element is selected in the slicer. This i how I want it to look. 

 

 

EXPECTED.PNG

 

I have created a simple measure: 



Measure = if(ISFILTERED(Table1[Namn]);1;0)


The measure works and checkes if the value is selected in the slicer or not.


measure1.PNGmeasure2.PNG
 



Once i try to add the measure in the conditional formatting for the bar chart, it does not work. Any clue to why? It just changes the bars to a red color as if an element was selected in the slicer.
CF.PNG


I am fearly new to POWER BI and DAX, so there might be something I am overlooking.

 

 

 

 

 

 

 

4 REPLIES 4
v-xuding-msft
Community Support
Community Support

Hi @n00b_90 ,

There is no way to implement the result you expected in one table directly.  When you use the column from the same as  table to filter, it will only  display the bar selected , not all the bars . Maybe  you could try  to create a new table in the data source , then to implement highlight in Power BI.

 

Best Regards,

Xue Ding

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

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

ok, so i have an ID in both the fact and Dim but the name (which is used as a filter) is only in the dim-table. Is there any way to make the code work with that information? Mayble like, when the name is filtered it looksup the ID value or something like that? 

 

kind regards, 

M

v-xuding-msft
Community Support
Community Support

Hi @n00b_90 ,

 

By my test,  you need to  modify the measure. The following measure you can have a try.

 

Measure  = var a = SELECTEDVALUE(Table2[Namn]) return IF(a in VALUES(Table1[Namn]),1,0)

Capture.PNGCapture1.PNG

 

 

Best Regards,

Xue Ding

 

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

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

Hi, 

 

Unfortunetly, I only have one table to base the code on. I can get the code to work with two tables as well, but that wont be an option for me since the data is connected through live connection. 

 
Any idea how i can modify the code in order for it to work on one table?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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