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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
EricPad
Regular Visitor

Dax column - Available Quantity Calculation not working

Hello - 

 

I have a relatively simple power bi report that works with Inventory data. 

The columns in my model are

  • Item Code
  • Item Code Desc
  • Order Type
  • Total Quantity on hand (Constant value per item code)
  • Quantity Ordered
  • Quantity BackOrdered
  • Quantity Shipped
  • Warehouse Code

I have created a Net On Order field with the folliowing data and it works correctly.

NetOnOrder =
    SWITCH (
        TRUE,
        vw_OpenOrdersByItem[OrderType] = "S", vw_OpenOrdersByItem[QuantityOrdered] - vw_OpenOrdersByItem[QuantityShipped],
        vw_OpenOrdersByItem[OrderType] = "B", vw_OpenOrdersByItem[QuantityBackordered],
        vw_OpenOrdersByItem[OrderType] = "M", vw_OpenOrdersByItem[MasterQtyBalance]
        )
 
I am trying to create an "Available" field which should be the Constant value of TotalQuantityOnHand minus my "NetOnOrder" column. 
 
I tried creating that like this:
Available =
    vw_OpenOrdersByItem[TotalQuantityOnHand] - vw_OpenOrdersByItem[NetOnOrder]
 
 
But this isn't working. The Available seems to be aggregating which I do not want. 
 
Here is a sample of the data
EricPad_0-1723587091256.png

 

 

In this table I would expect the available value to be -10623 but instead it's coming up with 96249.

EricPad_1-1723587158801.png

 

 

Any ideas what I could be doing wrong here?

   
2 ACCEPTED SOLUTIONS
v-kaiyue-msft
Community Support
Community Support

Hi @EricPad ,

 

Thanks for the reply from Ashish_Mathur , please allow me to provide another insight:

 

You can create a measure.

Available = 
    MAX(vw_OpenOrdersByItem[TotalQuantityOnHand]) - SUM(vw_OpenOrdersByItem[NetOnOrder])

vkaiyuemsft_0-1723786354549.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

View solution in original post

This worked perfectly! Thank you so much! 

I tried something similar as a column but not a measure. Thank you again for your help!

View solution in original post

9 REPLIES 9
v-kaiyue-msft
Community Support
Community Support

Hi @EricPad ,

 

Thanks for the reply from Ashish_Mathur , please allow me to provide another insight:

 

You can create a measure.

Available = 
    MAX(vw_OpenOrdersByItem[TotalQuantityOnHand]) - SUM(vw_OpenOrdersByItem[NetOnOrder])

vkaiyuemsft_0-1723786354549.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

This worked perfectly! Thank you so much! 

I tried something similar as a column but not a measure. Thank you again for your help!

EricPad
Regular Visitor

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1723777313019.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-kaiyue-msft
Community Support
Community Support

Hi @EricPad ,

 

Ashish_Mathur , thanks for your concern about this case. I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution: 

 

Try setting the field to "don't summarize".

vkaiyuemsft_0-1723601334529.png

 

vkaiyuemsft_1-1723601344966.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

 

 

When I click to not summarize the available field for some reason the Net On Order field value changes to an incorrect value as well. 

 

I think the Available field needs to be some type of sumx value where for a given item code the sum of the Net On Order is subtracted from the static (per item code) Total Quantity on hand but I haven't been able to get the syntax correct. 

 

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.  Clearly show the problem there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

where can I share it to?

 

Upload it to Google Drive and share the download link.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.