Forum Discussion
Dynamic summary table based on slicers
Hi,
I'm currently working on a Power BI project and have encountered a challenge that I hope to get some guidance on. My dataset consists of project information, where each row represents a distinct project. The core of my issue revolves around creating a dynamic table visualization. Specifically, I aim to showcase the number of locations corresponding to various project counts. I've seen some other posts about dynamic summary tables, but I didn't find the solution to my problem yet.
To illustrate, I wish to summarize my data in a manner that displays the count of projects per location and then aggregate this information to show how many locations have each specific count of projects. This summary is straightforward to achieve through a calculated table, and I've successfully created one that meets my needs. However, the complication arises with my desire for this summary to dynamically adjust based on the selections made in slicers within my report. I understand that calculated tables do not update with slicer changes, but only upon data refresh, which does not suit my need for interactive adjustments.
The challenge I'm facing is converting this logic into measures that can be used in a table visualization, thereby ensuring the summary reacts dynamically to slicer selections. Despite my efforts, I have not been able to accomplish this using measures.
Could anyone provide insights or guidance on how I can achieve a dynamic summary table that updates based on slicer inputs using measures instead of a static calculated table? Below is a simplified version of my data structure to aid in understanding my situation.
I've uploaded the file here:
https://drive.google.com/file/d/1mDCmxySqSn6QGIONRWas18pTdbPZeDvC/view?usp=sharing
- Anonymous2 years ago
Hi TimB99 ,
Please:
1. create a new measure:Max count = VAR __max_count = MAXX(SUMMARIZE(ALL('Projects'),'Projects'[location],"@count",[project_count]),[@count]) RETURN __max_count2. create a new table:
Table = GENERATESERIES(1,[Max count],1)3. create a new measure:
Amount of locations = VAR __summary_table_1 = SUMMARIZE('Projects','Projects'[location],"@count",[project_count]) VAR __summary_table_2 = SUMMARIZE(__summary_table_1,[@count],"@amount of locations",DISTINCTCOUNT(Projects[location])) VAR __cur_count = SELECTEDVALUE('Table'[Value]) VAR _result = MAXX(FILTER(__summary_table_2,[@count]=__cur_count),[@amount of locations]) RETURN _resultOutput:
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
2 Replies
- AnonymousNot applicable
Hi TimB99 ,
Please:
1. create a new measure:Max count = VAR __max_count = MAXX(SUMMARIZE(ALL('Projects'),'Projects'[location],"@count",[project_count]),[@count]) RETURN __max_count2. create a new table:
Table = GENERATESERIES(1,[Max count],1)3. create a new measure:
Amount of locations = VAR __summary_table_1 = SUMMARIZE('Projects','Projects'[location],"@count",[project_count]) VAR __summary_table_2 = SUMMARIZE(__summary_table_1,[@count],"@amount of locations",DISTINCTCOUNT(Projects[location])) VAR __cur_count = SELECTEDVALUE('Table'[Value]) VAR _result = MAXX(FILTER(__summary_table_2,[@count]=__cur_count),[@amount of locations]) RETURN _resultOutput:
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
- TimB99Regular Visitor
hi Anonymous,
Thanks for the clear solution, this indeed fixed my problem. I tried similar things before but always forgot at least one step haha. I've accepted your reply as a solution.
Cheers!