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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
claxxx
Frequent Visitor

Calculate MAX with dynamic dimension in Field Parameters

Hello, 

I have a table where I have my dimension which is dependent from a field parameter and my sales. The user can select one or various dimension in the field parameter; 

As a second mesure in the table I want to calculated the Max of my Sales. If nothing is selected like in my example below I should have "1746" as a Maximum Sales : 

claxxx_1-1705420379369.png

 

But If I select as a dynamic dimension "Country" then the Max sales should be "3214"

claxxx_2-1705420429353.png

I precise that I want this mesure "MAX SALES" to be in my table. So In the example above I Should have for the 3 lines the repetition of 3214. 

 

I've tried this DAX Formula : 

Max Sales_dynamic = CALCULATE(MAXX(ALLSELECTED('Dynamic Dimension'[Dynamic Dimension]),[SALES.]),ALLSELECTED('Dynamic Dimension'[Dynamic Dimension]))
 
but when I put it in the table i have the following message: "la colonne fait partie d'une clé composite, mais certaines colonnes de la clé composite ne sont pas incluses dans l'expression ou son expression dépendante*
 
thank you for your help 
here is the link of my pbi template https://we.tl/t-mGAXX5IsFr 
2 REPLIES 2
Anonymous
Not applicable

Hi @claxxx ,

Please try to change your measure with below dax formula:

Max Sales_dynamic =
VAR SelectedDimension =
    SELECTEDVALUE ( 'Dynamic Dimension'[Dynamic Dimension], "All" )
VAR MaxSales =
    CALCULATE ( MAX ( 'Sales'[SalesAmount] ), ALLSELECTED ( 'Sales' ) )
RETURN
    IF (
        SelectedDimension = "All",
        MaxSales,
        MAXX (
            FILTER (
                ALLSELECTED ( 'Sales' ),
                'Sales'[Dynamic Dimension] = SelectedDimension
            ),
            [SalesAmount]
        )
    )

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello , Thank you for your answer. 

In my case the measure Sales is in a table named "MESURES" where I stock all my measures. Should I refer to this table? 

In your formula I don't understand what 

'Sales'[Dynamic Dimension] 

refers to ? Because my Dynamic Dimension is just in my table

 'Dynamic Dimension'

created by the field parameters .

 

Other point, If the user select 2 fields how can I manage it in the dax formula

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.