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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register 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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors