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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
fridge81
New Member

Dynamic Column calculation based on Slicer Selection

HI,

 

I'm relatively new to PowerBI and have run into some trouble calculating a percentage in a way that the calculation updates depending on what filters are applied.  I have a scaled down example of what I'm trying to accomplish attached below.  My objective is to show market share per office, where market share is the sum of all revenues divided by the sum of all market sizes.  However, I want the calculation to update dynamically depending on what filters are applied in slicers to Industry Classification and Project Size.  Here is my raw data:

 

 

 

Sample DataSample DataSample Output with no filtersSample Output with no filtersSample Output with filters applied to Project Size (Medium) and Industry Classification (1 OR 3)Sample Output with filters applied to Project Size (Medium) and Industry Classification (1 OR 3)

5 REPLIES 5
Vvelarde
Community Champion
Community Champion

@fridge81

 

Hi, use a Measure instead of a column.

 

Regards

 

Victor




Lima - Peru
v-chuncz-msft
Community Support
Community Support

@fridge81,

 

You may first select Unpivot Columns in the Query Editor.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thyago_Rezende
Resolver I
Resolver I

Hi,

 

You can use ALLSELECTED function. Try it.

I've tried a number of solutions using ALLSELECTED (and various combinations of pivoted and unpivoted columns), and nothins seems to be working - I suspect my syntax is off.  In my most recent attempt, I was able to summarize all of the market size columns into a single column so that my input data now looks like the Sample Data below.  I've tried a few approaches, including calculating a column or set of columns to get my desired result, but nothing quite works.  My most recent approach was to try and create a table based on summarizing the existing one using

 

Table = SUMMARIZE(Sheet1,Sheet1[Office],"Filtered Revenue",CALCULATE(SUM(Sheet1[Revenue]),ALLSELECTED(Sheet1[Industry Classification]),ALLSELECTED(Sheet1[Project Size])),"Filtered Market Size",CALCULATE(sum(Sheet1[Attributable Market Size]),ALLSELECTED(Sheet1[Industry Classification]),ALLSELECTED(Sheet1[Project Size])))

 

This syntax yields the output pictured below, regardless of what slicers are applied.  I've used similar expressions (with adjustments to suit the calculation result, e.g. column vs measure vs table) to try and calculate columns and measures in my existing table and gotten similar results.  Can anyone point me in the direction of where I'm going wrong?

 

Sample DataSample DataResult of DAX codeResult of DAX code

Hi @fridge81,

 

I am confused,  Why should this simple formula not work

 

=SUM(sheet1[Revenue])/SUM([sheet1[Attributable Market Size])

 

Format this as a % age.  Now when you filter/slice your data, the figures should change.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.