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

SUMX returning blank results

Hiya

 

I have a Unit Price col from one table and a Qty in Stock col from another table.

I want to multiply the 2 together to get a total.

 

I have tried SUMX('Purchase Order Receipts', [QTY_IN_STORE] * (SUM('Purchase Orders'[Unit Price])))

This produces wrong totals.

I have tried value = SUM('Purchase Orders'[Unit Price])  then SUMX('Purchase Order Receipts', [QTY_IN_STORE] * [value])

This produces no totals - just a blank col.

 

This works for another calculation SUMX('Purchase Order Receipts', [QTY_IN_STORE] * 'Purchasing Budget'[Inv Value])

 

Cant understad why it works for one set and not another.

Thanks

3 REPLIES 3
Stachu
Community Champion
Community Champion

can you post sample data and syntax for [QTY_IN_STORE]



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

po spent error2.jpg

PO Spent = SUMX('Purchase Order Receipts', [QTY_IN_STORE] * [value])

 

Sytax for [QTY_IN_STORE]

select distinct p.order_no, p.contract, p.part_no, p.vendor_no, p.state, p.arrival_date, i.qty_in_store,
(AC.ACCOUNTING_YEAR * 100) + AC.ACCOUNTING_PERIOD AS "Arrival Period"
from PURCHASE_RECEIPT_NEW p
left join RECEIPT_INVENTORY_LOCATION i on i.order_no = p.order_no and i.part_no = p.part_no
LEFT JOIN ACCOUNTING_PERIOD AC ON p.arrival_date BETWEEN AC.DATE_FROM AND AC.DATE_UNTIL AND AC.YEAR_END_PERIOD_DB = 'ORDINARY'

 

Thanks

 

 

I should have been more specific - can you post examples (e.g. top 10 rows) from tables
'Purchase Order Receipts'
'Purchase Orders'
and explain the join between them?

I think the syntax you originally posted 

SUMX('Purchase Order Receipts', [QTY_IN_STORE] * (SUM('Purchase Orders'[Unit Price])))

is giving incorrect results, because there are multiple Prices referenced to single order. What the granularity at which the multiplication should be calculated?



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.