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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
kylewilley
Regular Visitor

Return Max of Any SelectedValue in Switch?

Hello all,

 

I am looking to be able to return the max value of a measure based on any value of the measure that filters the switch statement. Basically, what I have is this:

GroupCount = 
VAR  _1stTable = 
CALCULATE(SUM('Table 1'[IncCount]),FILTER([filter statement]))
VAR _2ndTable = 
CALCULATE(SUM('Table 2'[IncCount]),FILTER([filter statement]))
VAR _3rdTable = 
CALCULATE(SUM('Table 3'[IncCount]),FILTER([filter statement]))

RETURN
SWITCH(
SELECTEDVALUE(RiskAnalysisMetric[Metric]),

"AAA", _1stTable,
"BBB", _2ndTable,
"CCC", _3rdTable
)

 

The Switch works fine, but I am trying to create a graph with a max line for all metrics. I need to be able to run each iteration of the [Metric], and return the max value from _1stTable, _2ndTable, or _3rdTable, whichever is higher.

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @kylewilley 
It seems a scenario for field parameters, using them you can show all selections.

Please check this tutorial :

https://www.youtube.com/watch?v=TufnsAxJsjs

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @kylewilley 
It seems a scenario for field parameters, using them you can show all selections.

Please check this tutorial :

https://www.youtube.com/watch?v=TufnsAxJsjs

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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