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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.