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
Anonymous
Not applicable

How to sumx with predicate in another table?

Hi all, please help me with this case

Scenario, I have a sales table. I need to create a column Forecast Quantity base on the sales quantity in the sales table and put it in Forecast table.

Target store_ID and target product_ID is in the forecast table (don't need to calculate for all transaction)

In SQL it would be something like this 

SELECT SUM(QUANTITY) 
FROM W_SELLOUT_TRANSACTION_F  AS A
LEFT JOIN W_OPTIMAL_INVENTORY_F AS B ON
A.W_STORE_WID = B.W_STORE_WID
AND A.W_PRODUCT_WID = B.W_PRODUCT_WID
WHERE A.W_DATE_WID < 20191231
AND A.W_DATE_WID >= 20190101)

What I have in mind is like this:

Sell Out Qty = SUMX(V_W_SELLOUT_TRANSACTION_F,
CALCULATE(sum(V_W_SELLOUT_TRANSACTION_F[QUANTITY]),
V_W_OPTIMAL_INVENTORY_F[W_STORE_WID]=V_W_SELLOUT_TRANSACTION_F[W_STORE_WID],
V_W_OPTIMAL_INVENTORY_F[W_PRODUCT_WID]=V_W_SELLOUT_TRANSACTION_F[W_PRODUCT_WID],
V_W_SELLOUT_TRANSACTION_F[W_DATE_WID]<V_W_OPTIMAL_INVENTORY_F[FROM_DATE_WID]))

2019-09-26_12h52_39.png

2 REPLIES 2
amitchandak
Super User
Super User

create a concatenated field on W_STORE_WID and W_PRODUCT_WID and join tables W_SELLOUT_TRANSACTION_F W_OPTIMAL_INVENTORY_F
using that field.
Also, create a date dimension and join that with W_DATE_WID
Now you use date slicer or calculation in the formula to control your logic

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak , The data is very big (25M rows transaction data) and I already try an SQL solution. I want to find a DAX equivalent solution. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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