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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
lauriemclolo
Helper III
Helper III

How do I calculate the maximum of a parameter of multiple measure.

Hello. 

If I have a parameter and I want the max of whichever measure is chosen by the user, how do I create the max?  So, if I have three measures in a parameter, e.g. Sales, Profit, and Transactions, I want the maximum of whichever measure from the parameter the user chose.  If the user chose Sales, I want max sales.  But if theuser chose profit, I want the max profit.

10 REPLIES 10
v-saisrao-msft
Community Support
Community Support

Hi @lauriemclolo 

Could you please share the sample PBIX file? Since the sample PBIX or data has not been provided, we will close this thread. If the issue persists, feel free to open a new thread.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @lauriemclolo,

Could you let me know if the issue has been resolved? If not, please share the sample PBIX file so we can assist you in resolving the problem.

 

Thank you.

Poojara_D12
Super User
Super User

Hi @lauriemclolo 

You can solve this by combining your field parameter with a SWITCH statement so that the calculation adapts to the user’s choice. Here’s a working DAX pattern:

Max_SelectedMeasure =
VAR SelectedMeasure =
    SELECTEDVALUE ( 'Measure Parameter'[Name] )   -- the field parameter
RETURN
SWITCH (
    SelectedMeasure,
    "Sales", CALCULATE ( MAX ( Sales[SalesAmount] ) ),
    "Profit", CALCULATE ( MAX ( Sales[ProfitAmount] ) ),
    "Transactions", CALCULATE ( MAX ( Sales[TransactionCount] ) )
)

 

'Measure Parameter'[Name] comes from the field parameter table Power BI generates when you create a parameter. SELECTEDVALUE tells us which measure the user picked.

 

The SWITCH evaluates that choice and runs the corresponding expression.

 

For each case, CALCULATE ( MAX ( … ) ) returns the maximum value of the chosen measure.

 

If the user picks “Sales,” the formula gives the max sales, if “Profit,” the max profit, and so on.

 

This way, the measure dynamically responds to the parameter selection and always shows the maximum for whichever metric is chosen.

 

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
v-saisrao-msft
Community Support
Community Support

Hi @lauriemclolo,

As the issue remains unresolved, could you provide a small sample Pbix file along with the expected output? This will help us address the problem more effectively.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @lauriemclolo,

Have you had a chance to review the solution we shared by @Jihwan_Kim @danextian @Shahid12523 @KNP ? If the issue persists, feel free to reply so we can help further.

 

Thank you.

Jihwan_Kim
Super User
Super User

Hi, I am not sure if I understood your question correctly, but one of ways is to create field parameter and calculation group.

I tried to create a sample pbix file like below, and please check the below picture and the attached pbix file.

 

Jihwan_Kim_2-1756264431942.png

 

 

Jihwan_Kim_0-1756264357902.png

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
danextian
Super User
Super User

You will need to create a measure that references either the field or order column of the parameter - not name column as this will result to an error.

SWITCH (
    SELECTEDVALUE ( 'parameter'[parameter order] ),
    1, MAX ( 'Table'[sales] ),
    2, MAX ( 'Table'[profit] )
)

Note: MAX may not be the actual function to use as this will depend on wha max you are trying to calcualate - eg the max of monthly sales.





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.
Shahid12523
Resident Rockstar
Resident Rockstar

Use a SWITCH with SELECTEDVALUE:

 

If they’re columns:

 

Selected Measure Max =
SWITCH(
SELECTEDVALUE('Measure Parameter'[Measure Parameter]),
"Sales", MAX('Table'[Sales]),
"Profit", MAX('Table'[Profit]),
"Transactions", MAX('Table'[Transactions])
)


If they’re measures:

 

Selected Measure Max =
SWITCH(
SELECTEDVALUE('Measure Parameter'[Measure Parameter]),
"Sales", [Max Sales],
"Profit", [Max Profit],
"Transactions", [Max Transactions]
)


👉 Replace [Max Sales], [Max Profit], etc. with your existing max-calculation measures.

Shahed Shaikh

They are neither columns nor pre-calculated max measures.  It is a parameter of measures, none of which is a max measure.  Sales is a Measure, Profit is a Measure and Transactions is a Measure. So, will I have to precaulate the max of each measure?

KNP
Super User
Super User

Hi @lauriemclolo,

 

Are you talking about field parameters?

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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