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

Use Slicers to find the min value amongst 3 options

I am using Power BI for the S&OP process in our company.  I have brought in the information on how much inventory we have on hand and expected to received.  The user can look into multiple different products to view this information. 

 

We tend to sell multiple products together.  I am trying create a measure based on slicer selection that will compare the amount of inventory for each product and find the min value.  Currently, when selecting multiply products the inventory increases.  It would be useful to determine which product has less inventory use this as a constraint.  I know this will mean a disconnected table and the swith() function.

  Data.PNGDVR Kit graph.PNGInstall Kit.PNGthe above two products are sold together.  If both of these products are selected the graph should be constrained by the bottom graph.

 

Thank you for the help,

 

Michael

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@mschwartz

 

If you only want to get the min inventory selected products, you can use ALLSELECTED() in CALCULATE() function.

 

Min Inventory = CALCULATE(MIN(Inventory[Inventory]),ALLSELECTED(Inventory[Product]))

99.PNG

 

 

You can put above measure into your chart.

 

Regards,

View solution in original post

4 REPLIES 4
mschwartz
Frequent Visitor

Simon_Hou-MSFT,

 

This worked out perfectly.

 

Thank you for the help

 

Michael

If you can help answer one more inquiry.  The Dax formula provided works great when selecting multiple options but if there are no products selected, the measure needs to clear/ reset to showing all inventory available.  I would try using an if statement but I don't think calculate can be used in an if statement.

 

Thank you for the help,

 

Michael

@mschwartz

 

You can try formula below:

 

Measure = IF(HASONEVALUE(Inventory[Product]),CALCULATE(MIN(Inventory[Inventory]),ALLSELECTED(Inventory[Product])),CALCULATE(SUM(Inventory[Inventory])))

9.PNG

 

Regards,

v-sihou-msft
Employee
Employee

@mschwartz

 

If you only want to get the min inventory selected products, you can use ALLSELECTED() in CALCULATE() function.

 

Min Inventory = CALCULATE(MIN(Inventory[Inventory]),ALLSELECTED(Inventory[Product]))

99.PNG

 

 

You can put above measure into your chart.

 

Regards,

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.