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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TimB99
New Member

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.

TimB99_0-1708592906794.png 

TimB99_1-1708592952759.png 

I've uploaded the file here:

https://drive.google.com/file/d/1mDCmxySqSn6QGIONRWas18pTdbPZeDvC/view?usp=sharing 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

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_count

 

2. 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
_result

 

Output:

vcgaomsft_1-1708654865243.png

vcgaomsft_3-1708654915015.png

Best Regards,
Gao

Community Support Team

 

If 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

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

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_count

 

2. 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
_result

 

Output:

vcgaomsft_1-1708654865243.png

vcgaomsft_3-1708654915015.png

Best Regards,
Gao

Community Support Team

 

If 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

hi @v-cgao-msft

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! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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