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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
fonsogijon
Frequent Visitor

Dynamic Summarize Calculation

Hello,

 

I would like to create a measure where the totals is the sum of each row instead the calculation.

 

I managed to get that by using following formula:

Vol_impact =
SUMX(ADDCOLUMNS(SUMMARIZE(Table1, Table1[Col1], Table1[Col2]), "This", [Vol_impact]), [This])
 
However, there is not going to be always "Col1" or "Col2" as this are columns selected by user using the field parameter functionality.

I have thought to use something like this:

 

 

Vol_impact_all = 
VAR SelectedColumns = CONCATENATEX(Parameter, Parameter[Parameter Fields], ", ")
VAR ExpresionDAX = 
    "SUMX(ADDCOLUMNS(SUMMARIZE(Table1, " & SelectedColumns & "), ""This"", [Vol_impact]" & "), [This])"
RETURN
ExpresionDAX

 

 

 
Where SelectedColumns is correctly returning:
Table1[Col1], Table1[Col2], and adding more in case more are selected.
 
Which is dynamically working, but I have only the text. So I would like to "execute" this text. I thought with EVALUATE could be possible but it is not working.
 
Any idea?
 
Thanks in advance
4 REPLIES 4
amitchandak
Super User
Super User

@fonsogijon , I doubt that in power bi as of now(Dynamic table based on selection).

 

You have to write a switch and combination

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

But I have around 30 columns available for users and they can select any number, so the combination is huge.
However, it looks like this variable is working fine, adding columns when users add columns in the slicer:

VAR SelectedColumns = CONCATENATEX(Parameter, Parameter[Parameter Fields], ", ")

And also the summarize formula returned is also dynamically changing base on the selection. The problem is that I have just the text, but seems to be fine, if only I could somehow evaluate that text...

Any way..Thank you!! @amitchandak 

Hi, I am having the same issue :S did you find the way to solve it?

No, I just defined the lowest level possible that is also the default one and then it aggregates up depending on the selection

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.