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
hozefamk
Frequent Visitor

How to calculate minimum of a value from a group of similar values in other column ?

I have a field name material and Kitting quantity, here i have filtered for only one particular material type, there are hundreds of different material arranged randomly in row. I have another field kitting quantity where values are different for even same material quantity. I want to create a new row, which should calculate the minimum value of Kitting quantity out of all similar material and print the same correspondance to them in the new column.

solution.PNG

 

Field highlighted in Yellow are my given field and higlighted in blue is the desired output.

P.S: Material can be arranged randomly in any order so Filter(Table(field)=Earlier(Table(field)) is useless in this case and I am looking to solve in Power Query using Custom Colum.

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @hozefamk,

 

Please refer to below DAX formula to create a calculated column.

Min Column Quantity =
CALCULATE (
    MIN ( Table[Kitting quantity] ),
    ALLEXCEPT ( Table, Table[Material] )
)


Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yulgu-msft
Employee
Employee

Hi @hozefamk,

 

Please refer to below DAX formula to create a calculated column.

Min Column Quantity =
CALCULATE (
    MIN ( Table[Kitting quantity] ),
    ALLEXCEPT ( Table, Table[Material] )
)


Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Turnipface
Advocate I
Advocate I

It worked in 2 ways in a small test that you can see here as .pbix


Option 1 was to display it as a table and measure the quantity as "Minimum"

image.png

 

Option 2 was to Add a new column with formula =  MIN(Kitting quantity)

 

Do any of these work for what you're trying to do?

 

 

As per your solution you get minimum value same for all rows. from your application i need minimum value to be 3 for wood and 4 for Stone. 

Fair point...i guess i should have checked before sending 🙂
It does seem to work as a Measure with the same formula, but not as a column. I can't seem to get it to work as a column.
Perhaps somebody else can help here.

bidevsugmen
Resolver I
Resolver I

Hi @hozefamk

 

What is source of this data? Is it SQL Server Database?

 

 

Thanks,

Suguna.

I am extracting data from Excel

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.