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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
CLNersesian
Kudo Kingpin
Kudo Kingpin

DAX Formula Problem

Hi - 

 

I'm using the following DAX formula : 

 

Bookings Amt = CALCULATE(SUM('Sales Transaction'[Ordered Amount]), FILTER('Sales Transaction', 'Sales Transaction'[Ordered Quantity]>0))-'Sales Transaction'[Amt Invoiced]

 

I'm trying to only show values that are not equal to zero, or in another case not negative.

 

To Be Shipped Qty = CALCULATE(SUM('Sales Transaction'[Ordered Quantity]), FILTER('Sales Transaction', 'Sales Transaction'[Ordered Quantity]>=0))-CALCULATE(SUM('Sales Transaction'[Packing Slip Quantity]), FILTER('Sales Transaction', 'Sales Transaction'[Packing Slip Quantity]>=0))

 

I'm not sure what I'm doing wrong - so if anyone has any suggestions, please let me know. I'm not stellar with DAX!!

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

Hi There,

 

Bookings Amt = CALCULATE(SUM('Sales Transaction'[Ordered Amount]), FILTER('Sales Transaction', 'Sales Transaction'[Ordered Quantity]>0))-'Sales Transaction'[Amt Invoiced]

 

In the first formula, the dark black part is naked column reference and is not valid for aggregations. You should use SUM with the formula.

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

2 REPLIES 2
v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi CLNersesian,

 

Could you please explain a bit about what the errors or issues that you are trying to resolve?

Only showing the DAX formula is not so helpful for us to understand your situations.

For the formula "Bookings Amt ", as BhaveshPatel suggested, DAX would not allow to put a column in a measure.

To have it work, either add a sum function:

Bookings Amt := CALCULATE(SUM('Sales Transaction'[Ordered Amount]), FILTER('Sales Transaction', 'Sales Transaction'[Ordered Quantity]>0))-SUM('Sales Transaction'[Amt Invoiced])

Or create a measure first:

Bookings Amt1 := CALCULATE(SUM('Sales Transaction'[Ordered Amount]), FILTER('Sales Transaction', 'Sales Transaction'[Ordered Quantity]>0))

Then another calculated column to do the minus:

Bookings Amt = [Boolings Amt1] - 'Sales Transaction'[Amt Invoiced]

For the second formula, if they are for the same products, then that is good to go, otherwise, we need to add another filter for different products.

Please reply back if you need any further assistance.

Regards

BhaveshPatel
Community Champion
Community Champion

Hi There,

 

Bookings Amt = CALCULATE(SUM('Sales Transaction'[Ordered Amount]), FILTER('Sales Transaction', 'Sales Transaction'[Ordered Quantity]>0))-'Sales Transaction'[Amt Invoiced]

 

In the first formula, the dark black part is naked column reference and is not valid for aggregations. You should use SUM with the formula.

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors