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

DAX Formula Compare rows

Hi

In the table below I have

 

Qty Price = DIVIDE(sum(Table A [Inv Value EUR]);SUM(Table A[fN Inv Qty]))

 

Cost of Material = IF(SUM(Table B[Open quantity])>SUM(Table A [fN Inv Qty]); sum(Table A[fN Inv Value EUR]);[Qty Price]*sum(Table B[Open quantity]))

 

Total Qty= IF(sum(Table B[Open quantity])>SUM(Table A[fN Inv Qty]);sum(Table B[Open quantity]);SUM(Table A[fN Inv Qty]))

 

So the problem is I m getting the Total wrong, I know that there is some problem in the formula but I don t know how to resolve it

 

Moreover, I would like that when I have a blank cell that was considered as 0

 

(in the Example I should have as Tot Cost of Material 29767,16 €)

image.png

 

Thanks

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Cuscino

 

Have you created a relationship of the two tables A and B?

 

If it is convenient, could your share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? 

 

In addition, you could use If function to set a blank cell to be 0 like the formula below.

 

If ( isblank(),0,...)

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

So

 

I have Table B, where I have all the Sales Order, Site of the warehouse, with multiple Items and the Open Qty

 

 

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Table A is jsut the Inventory so Items, Inv Qty and the € Values

 

Then there is a Connection Table (Table C) between this two table, where we have all the Items 

 

I m trying to compare this two tables in one unique visualization image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The formula in the table are working fine, the problem is the Totals

 [Cost of Material ] = IF(SUM(Table B [Open quantity])>SUM(Table A [fN Inv Qty]);sum(Table A[fN Inv Value EUR]);Qty Price*SUM(Table B[Open quantity]) 

 

 Here is basically using the Total instead of each single row and that´s why the Total isn´t right

 

Total Qty= IF(sum(Table B[Open quantity]) > SUM(Table A[fN Inv Qty]); SUM(Table A[fN Inv Qty]);sum(Table B[Open quantity])) 

 

I´m trying also to create a Slicer that indicates where we have Inventory or shortage, so If Open Qty > Inventory then Shortage otherwise Inventory. 

 

Thanks

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.