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 August 31st. Request your voucher.

Reply
r_ramillien
Regular Visitor

Filing a column with the min value of another column

Hello all,

 

I stuck on a problem which seems very basic.

 

I would like to create a column or measure which contains the minimum value of all rows of another column.

I want to it to be sensitive to filters, that's why I can't use power query.

 

To make an example, I have a table like this.

 

key | value

0    | 10

0    | 20

0    | 30

1    | 5

 

Supposing I have a filter on key 0, I would have someting like this:

 

key | value | min

0    | 10      | 10

0    | 20      | 10

0    | 30      | 10

 

This is not my "real" use case. But I need this step to implement it.

I tried a lot of solutions based on min, mina, minx, etc. Using columns or measures, but nothing seems to work. In most cases, the min value is equal to the value of the same row. So, how can I do to fill all the rows with the min value found in filtered rows ?

 

I think I approches a solution with this kind of formula:

CALCULATE(MIN('Test'[value]), ALLEXCEPT('Test', 'Test'[key], 'Test'[another column]))

But if I remove the "allexcept", this do not works anymore. I would not add all my segments in the allexcept. I would like CALCULATE to use the segments on the page.
 

Best regards,

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

To have it respond to slicers, it needs to be a measure.  Please try this one.

 

MinThisKey = CALCULATE(MIN(test[value]), ALL(test[Value]))

mahoneypat_0-1634430326646.png

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

To have it respond to slicers, it needs to be a measure.  Please try this one.

 

MinThisKey = CALCULATE(MIN(test[value]), ALL(test[Value]))

mahoneypat_0-1634430326646.png

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hello,

 

Thank you, it works great !


When I read the documentation for "ALL", I understand that it resets all filters. So I thought the result for all rows would have been "5" instead of 10. I'm not sure to understand how it works then, but it works. Thank you !

CNENFRNL
Community Champion
Community Champion

Resort to Calculated Column since it's only an intermediate step.

Screenshot 2021-10-16 222653.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Hello,

 

Thank you for your help, I see that it works for you. But the same code do not works for me !?

 

Capture d’écran 2021-10-16 232017.png

 

It says "EARLIER/EARLIEST make a reference to a previous row context which do no exists."

 

Any idea please ?

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.