Forum Discussion
Filtering from a chart
Hi,
I have piechart, containing several values calculated from Columns and measures.
I wish to select a category in the chart and been able to display its value in a card.
Depending on the category I choose, the card should show the value selected in the chart.
If nothing is selecting, the total is displayed.
is it possible to do it in PBI?
regards
Ok, eventually I figured it out.
1. I created a new table containing the name of the measures I want to display.
Table2 = {("Measure1 name",1),("Measure2 name",2)}2. I created a new measure that switches the between column or measure
Total =IFERROR(VALUES([Table2]),""),"Measure1 name",SUM([Measure1]),"Measure2 name",SUM([Measure2]),[ALL])
Then in the charts, I replaced all the measures with my new "Total" and put "Table2" in the Chart legend.I also replaced the card with "Total" measure.Bottom line: when I select any element of the chart, the card updates the value accordingly.
10 Replies
- johnt75Super User
That is the default behaviour, when you make a selection in one visual on a page that selection will filter all the other visuals on that page.
If you put the same measure which you are using in the pie chart onto a card visual, selecting a category in the pie chart will filter the card visual to only show values for that category.
- MagikJukasResolver III
Nope, from a chart to another chart or a matrix/Card it does not.
From a Matrix to a chart/card, indeed it works.
... and edit interactions are set correctly.
- johnt75Super User
it works for me from a pie chart to a card. try having a look at the queries generated. open Performance Analyzer and start recording, click on one of the categories in your pie chart and then copy the query generated for the card visual. paste that into DAX Studio and see what filters are being applied
- MagikJukasResolver III
I think the problem is that my piechart contains several different values (measures) instead of one with several legends.
Indeed the second solution would have worked as you suggested.
the main problem is if it is possible with DAX to acknowledge when a measure is selected /filtered.
I tried Isfiltered and iscrossfiltered, but it does not recognize when selected.
- johnt75Super User
I think the output from Performance Analyzer might still help. If you compare the queries with nothing selected and with a value selected that should show you the difference. If there is no difference then no filter is being applied and you have no hope of detecting anything, you would need to rethink how you're approaching the problem. If there is a difference, and a filter is being applied, then it should be possible to examine whatever the filter is being applied to and determine whether or not it is being filtered.
One possible method for detecting a filter on a measure might be something like
Measure is filtered = var currentValue = [Measure] var totalValue = CALCULATE([Measure], ALL() ) return currentValue <> totalValue