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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
robranieri
Regular Visitor

Field Parameters in Matrix Sales Share Calculation

Hello PBI Community,

 

First and foremost, the underlying data and the PBI example (let me know if the links don't work):
Excel Data 

PBI Report 

 

There are two datasets in the Excel: Sales data has ProductID, RetailerKey, TimeID and Sales. The prod hierarchy (ProductH) has ProductID and other categorical information like Category, Subcategory, Brand, & Item. 

 

I have a very specific issue that is arising from how parameters work inside of a matrix. The use-case is that users need to be able to define their rows and their columns via field parameters and see their sales share within those slices. In the example data, I've made 2 identical field parameters in order to solve for this ask so that users can pick what they want to see. In the screenshot below, I need to adjust the "Denominator" measure so that based on whatever is selected in the Columns it maintains that specific column's total. Therefore the share values should represent the share within that specific option selected.

robranieri_0-1753226896209.png

 

It should look more like this (when the column is by Retailer):

robranieri_1-1753227289600.png

The denominator adjusts dynamically above so that the share values are now all correct. I can hard-code this for the Retailer, but need to make it reflect and adjust based on whatever is selected (and it can be more than one selection) in the Columns field parameter. 

 

What I need is the DAX code for the denominator that adjusts dynamically in order to calculate the correct share values.

Thanks All,

Rob

 

8 REPLIES 8
v-hashadapu
Community Support
Community Support

Hi @robranieri , Hope you are doing well. Kindly let us know if the issue has been resolved or if further assistance is needed. Your input could be helpful to others in the community.

No, the issue has not been resolved

Hi @robranieri , Thanks for the update. But can you be more specific on the results and share any other relevent details.

Thank you.

v-hashadapu
Community Support
Community Support

Hi @robranieri , Hope you're doing okay! May we know if it worked for you, or are you still experiencing difficulties? Let us know — your feedback can really help others in the same situation.

v-hashadapu
Community Support
Community Support

Hi @robranieri , hope you are doing great. May we know if your issue is solved or if you are still experiencing difficulties. Please share the details as it will help the community, especially others with similar issues.

danextian
Super User
Super User

Field parameters don’t dynamically adjust how filters are applied in your measure. No matter which field is selected from the parameter, the formula will still apply ALLSELECTED to the Sales table as a whole.

CALCULATE ( [Sales], ALLSELECTED ( Sales ) )

You will need to write a conditional measure to detect which parameter value is being selected.

Denominator =
SWITCH (
    SELECTEDVALUE ( ColumnParameter[ColumnParameter Order] ),
    1, CALCULATE ( [Sales], ALLSELECTED ( Sales[RetailerKey] ) ),
    2, CALCULATE ( [Sales], ALLSELECTED ( ProductH[Category] ) ),
    3, CALCULATE ( [Sales], ALLSELECTED ( ProductH[Subcategory] ) ),
    4, CALCULATE ( [Sales], ALLSELECTED ( ProductH[Brand] ) ),
    5, CALCULATE ( [Sales], ALLSELECTED ( ProductH[Item] ) )
)

Power BI does not allow directly referencing the Parameter value thus the use of Parameter Order column instead. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

This did not work:

robranieri_0-1753277139469.png

It also has to be ready to calculate for when mutliple options are selected, not just a single selected value from the Column parameters. 

I think we're on the right track though!

Hi @robranieri , Thank you for reaching out to the Microsoft Community Forum.

 

Please try below and share your thoughts.

 

DenominatorDynamic = CALCULATE([Sales], REMOVEFILTERS('ProductH'[Subcategory]),KEEPFILTERS(VALUES(ColumnParameter[ColumnParameter) 

 

then just use:

 

SalesShare = DIVIDE([Sales], [DenominatorDynamic])

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.