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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
kkanda
Resolver II
Resolver II

Create a measure based on selection of item in the chart

I have a simple bar chart in which we have categories listed against the sales. By selecting the value in the slicer for categories, we can get a measure of selected value of the slicer. However, when I click on a bar in the chart, all other bars get faded. Now, will it be possible to get the name of the category as a measure based on the category bar I clicked on the chart? 

Thanks for any suggestions

1 ACCEPTED SOLUTION
nandic
Super User
Super User

Hi @kkanda ,
Would you like to have a measure that displays selected bar?
Below is example: there are three products, showing sales on bar chart. I created a measure which returns clicked Bar.

If i click on product A, measure returns "A", if i click on product C, measure returns "C".


Dax measure: 

Clicked =
var ClickedItem = VALUES(Sheet1[Product])
RETURN
FILTER(ClickedItem,ISFILTERED(Sheet1[Product]))

Selected bar A.PNG

Selected bar C.PNG

Cheers,
Nemanja

View solution in original post

2 REPLIES 2
nandic
Super User
Super User

I would like to add addition to my previous post: as Power BI is interactive, if you click on one bar it automatically filters everything on that page related to selected bar (example, product A). So it might seem that this new field is not needed.
There are several ways to test formula from above.
You can insert text box and set title to specific field.

Steps below:
Text title.PNG

Step 2:

Text title 2.PNG
If you selected Based on field "Product", this text item will display correct product, but only if bar chart is selected. If bar char not selected, it will always display some value (first product). If you selected Based on field "Clicked" it will display value only if bar is selected.

Second test: display it as a list. If you select product A, list will automatically display only product A. But if you select nothing on bar chart, it will display all products.

Cheers,
Nemanja

nandic
Super User
Super User

Hi @kkanda ,
Would you like to have a measure that displays selected bar?
Below is example: there are three products, showing sales on bar chart. I created a measure which returns clicked Bar.

If i click on product A, measure returns "A", if i click on product C, measure returns "C".


Dax measure: 

Clicked =
var ClickedItem = VALUES(Sheet1[Product])
RETURN
FILTER(ClickedItem,ISFILTERED(Sheet1[Product]))

Selected bar A.PNG

Selected bar C.PNG

Cheers,
Nemanja

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors