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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Farwest
Frequent Visitor

Dynamic max calcuation in Power Query

Hi,

 

I am trying to calcualte a dynamic Max value from one column in Power Query Editor.

An example below where I have different groups, I would like to be able to have dynamic Max value measurement based on one selected group, but not only I would to be able to measure the Max among several number of groups and all the groups.

I am using the Max value for the following step in Power Query to define boundaries.

 

Capture.JPG

 

The final goal is to be able in Power Bi viewer to dynamically change these calculated boundaries based on the groups selected for a same visual.

 

Thanks for the help

Cheers

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Farwest ,

 

As @artemus  said, we cannot achieve that by power query. We can create a meaure by DAX as below to work on it.

MAX = CALCULATE(MAX('Table'[Probability]),ALLSELECTED('Table'))

Capture.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Thank you for the answer,

 

I managed to get out of this problem.

I am still struggling with some other dynamic calculations.

 

I am trying to use a filter in order to set a measure, it is a single selection filter.

Selected = if(HASONEVALUE('Table['Name]);SELECTEDVALUE('Table[Name]);"ALL")

I am getting the selected filter through this and using switch to select a column based on the selection
 
SWITCH([Selected];
"ALL";MAX(Table[Sales 1]);
MAX(Table[Sales 2]))
 
here I would like to use a column if nothing is selected (Table[Sales 1]) and the other column (Table[Sales 2]) for any single selection filter. it does not look to be working as "ALL" is not in Table[Name]. is there a workaround for this.
 
Please let me know if I must create a new topic for this
 
Thanks,

Dear Community,

 

I am still struggling with the filter selection, 

I created a measure to get the selected value or get "ALL" instead

 

Selected = if(HASONEVALUE('Table'[Tool Name]);SELECTEDVALUE('Table'[Tool Name]);"ALL")
 
Measure = SWITCH([Selected];
"ALL";MAXX('Table'[Result 1]);
 MAX(''Table'[Result 2]))
 
Does not seem to swith, I always have the same column returned.
 
Thanks.
artemus
Employee
Employee

I'm not entirly sure what you are trying to accomplish, but...

 

1. If you have loaded all the data you need to calculate the values, you should be able to write a dax measure which does what you want. Chances are one of the quick measures that is offered will work.

 

2. If you are using direct query, and have not loaded the data needed to calculate the value, then you will probably need to wait until the filter on parameter is implemented in Power Bi. Doing this your self is possible, but quite difficult, and has many caveats.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors