Forum Discussion
How to Find Column's Minimum value based on other columns group
- Anonymous9 years ago
The way to achieve this is using EARLIER function:
Column = CALCULATE(MIN(Table1[TransitDays]),FILTER(Table1,Table1[Plant]=EARLIER(Table1[Plant])))
Hope this helps
Michael Shparber
- 9 years ago
Hi devenchj,
For the sample data, add an index column in Power Query Edit by selecting Index Column(from0,1) under Add column on home page.
Create a measur using the formula.Measure = MINX(FILTER(SELECTCOLUMNS(ALLSELECTED(Table2),"index",Table2[Index],"Min",MINX(FILTER(Table2,Table2[Plant]=EARLIER(Table2[Plant])),Table2[Value])),[index]=MAX(Table2[Index])),[Min])
Please see the screenshot, it will calculate the min value based on [Plant] field in diferrent months.
You can dowbload mine .pbix file, and test using Table2.
Best Regards,
Angelia
Hi devenchj,
For the sample data, add an index column in Power Query Edit by selecting Index Column(from0,1) under Add column on home page.
Create a measur using the formula.
Measure = MINX(FILTER(SELECTCOLUMNS(ALLSELECTED(Table2),"index",Table2[Index],"Min",MINX(FILTER(Table2,Table2[Plant]=EARLIER(Table2[Plant])),Table2[Value])),[index]=MAX(Table2[Index])),[Min])
Please see the screenshot, it will calculate the min value based on [Plant] field in diferrent months.
You can dowbload mine .pbix file, and test using Table2.
Best Regards,
Angelia
Hi, I have got a same scenario and the measure v-huizhn-msft provided works correctly but difficult to understand the concept behind, how do i filter out another column within the same table to get the minimum along with other filtered columns? i.e. for example first three columns are correctly filtered out with your v-huizhn-msft solution but I'm not sure how to filter out the last column using the same measure.
Please advise. Thanks