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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
ekent
Frequent Visitor

Help Calculating Available Quantity Correctly

Got a data related issue that is being fixed in the background but could take a while, so I am looking for a DAX Band-Aid to just let me work with what I've got for right now. Our company database stores an "Available Quantity" field to reflect how much we have of a particular item that is available for purchase (either in a warehouse or in transit to us). However, this field does not contain any 0's and instead only has blank rows for the Quantity column. There is also an "Available Quantity %" field that SHOULD be calulcating the number of items in a category for which there is at least 1 unit available, and then dividing this by the total number of distinct items in that category. For instance, we sell 75 different items in the "Desk" Category, and if 19 of these desks had at least 1 unit available for purchase, the "Available Quantity %" would be 25%.

ekent_0-1677692353912.png

This is clearly not the case though, and our data team will hopefully resolve why they all say 100% soon. However, for now, I was hoping to use DAX to get the correct % that I need, and I have created a measure that simply gives the Available Quantity, for each item, but replaces blank values with 0 (the 4th column in the table on the right, "MSR - All Available Quantity"). I am TRYING to get a sum for either all the items in a category that HAVE availabilty (> 0) or do NOT have it (blank or = 0), as I only need one or the other to be able to divide this by the total number of items in the category and get an accurate %. I have tried COUNTROWS(), ISBLANK(), SUMX(), and anything I can think of but I cannot get a good measure created. I even made a measure to flag items that gives 1 if there is a unit for purchase and 0 otherwise, for every single item we sell, and was hoping to filter by category and take a sum, but this has proven difficult... Please help!!!

1 REPLY 1
andhiii079845
Super User
Super User

Can you please post more information about the involed tables, columns. Perhaps relationships? 
Also some example data (NO screenshot) with your desired result? 
Without it is very difficult to help. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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