Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have a Power BI table with three columns: ID, Title, and Name.
I created two clustered bar charts:
Each chart has a visual-level filter applied to show only the top 3 based on ID count.
When I select a Name in Chart 1, Chart 2 updates, but it does not recalculate the top 3 Titles based on the selected Name—it just filters the existing top 3 Titles. Similarly, selecting a Title in Chart 2 does not dynamically update the top 3 Names in Chart 1.
If I select a Name, I want Chart 2 to show the Top 3 Titles related to that Name (not just filter the default top 3). Likewise, selecting a Title should update Chart 1 to show the Top 3 Names related to that Title.
Note: There are more than 1000 records in my table, and there are more than 20 distinct Titles and Names each.
Is there a way to achieve this in Power BI?
Solved! Go to Solution.
Hi @adi38612 ,
According to your question, you want to filter the first table (e.g. name) and then sort based on the values filtered by the first table right?
We can first use the RANKX function on the name column and total column sorting, and then create a new Topn table to Topn table to filter you need the first few rankings, and finally write a measure to put into each chart to achieve your needs!
Name ID Count =
CALCULATE(COUNT('Table'[ID]), ALLEXCEPT('Table', 'Table'[Name]))
Rankx Name =
RANKX(ALLSELECTED('Table'[Name]),[Name ID Count],,DESC,Dense)
Top N = GENERATESERIES(1, 10, 1)
Top N Names = IF([Rankx Name] <=SELECTEDVALUE('Top N'[Top N]), 1, 0)
If you have any other questions, you can check out the pbix file I uploaded, I hope it helps, and I'd be honored if I could solve your problem!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @Anonymous, It worked like a charm.
Quick update: the 'Filter' interactions between the two visuals should be enabled, both ways!
Hi @adi38612 ,
According to your question, you want to filter the first table (e.g. name) and then sort based on the values filtered by the first table right?
We can first use the RANKX function on the name column and total column sorting, and then create a new Topn table to Topn table to filter you need the first few rankings, and finally write a measure to put into each chart to achieve your needs!
Name ID Count =
CALCULATE(COUNT('Table'[ID]), ALLEXCEPT('Table', 'Table'[Name]))
Rankx Name =
RANKX(ALLSELECTED('Table'[Name]),[Name ID Count],,DESC,Dense)
Top N = GENERATESERIES(1, 10, 1)
Top N Names = IF([Rankx Name] <=SELECTEDVALUE('Top N'[Top N]), 1, 0)
If you have any other questions, you can check out the pbix file I uploaded, I hope it helps, and I'd be honored if I could solve your problem!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi Adi38612,
Does your ID column have unique values? How is the ID column made up? Is it related to the Name column?
Thanks!
Maral
User | Count |
---|---|
16 | |
14 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |