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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
EugenioBeltran
Frequent Visitor

Sumifs in Dax

Hello I am new to DAX and need some help

I manage hundreds of purchase orders and need a create a key or bridge that will kelp me join two tables together

 

In the first table i can have 1 or several summarized (by cases) purchase orders (PO) with the same number but with different amount of cases  so I created at the columns a concatenate([purchase],[cases]), as a key, all good so far

 

The second table has the same purchase order (PO) numbers but the cases are not summarized, they are broken down by item so the cases need to be summarized based on a column named sales order (So) so that the sum of cases will match the cases per purchase order of the first table and then do a concatenate like in table 1 to create the key to create a relationship between the two tables

 

Each table contains different data that is needed to create a report so the two need to be joined.

 

Table 1 example

PO cases concatenate

A.   20.     A20

A.   24     A25

B    12     B15

B.   24.    B24

 

Table 2 example 

PO     So       item   cases

A          1        a          8

A          1        b         12. Sum So 1= 20

A          2        a          4

A.         2.       b.         20 Sum So 2 = 24

B          3        a          4

B          3        b          8 Sum So 3 = 12

B          4        c          12

B          4        a          12 Sum So 4 = 24So in table two the sum of the So will allow me to concatenate the PO with the cases and create a key to create a relationship between the two tables

Hope it makes sense

1 ACCEPTED SOLUTION

@EugenioBeltran 
Yes, you can use WeTransfer or any cloud service to share the download link

View solution in original post

14 REPLIES 14
FreemanZ
Super User
Super User

hi @EugenioBeltran 

tamerj1's solution worked perfectly. you may also try like:

column2 = 
[PO]&
SUMX(
    FILTER(
        Table2,
        Table2[PO]=EARLIER(Table2[PO])
            &&Table2[SO]=EARLIER(Table2[SO])
    ),
    Table2[Case]
)

they worked like:

FreemanZ_0-1682216571332.png

 

It worked, it worked but know it's saying We could not refresh the Data Model from the source data. Here is the error message we got. A circular discrepancy was detected "Table2(key), table2(key), Table2 (key), no idea were to look for it

I also used your formula to calculate the pallets, no dure if this is causing it

SUMX( FILTER( Table2, Table2[PO]=EARLIER(Table2[PO]) &&Table2[SO]=EARLIER(Table2[SO]) ), Table2[Calculated pallets]) ?

 

Or the one I used before to calculate the pallets calculated pallets = table2(cases per pallet/table2cases)

tamerj1
Super User
Super User

Hi @EugenioBeltran 

Please try

concatenate =
Table2[PO]
& CALCULATE (
SUM ( Table2[cases] ),
ALLEXCEPT ( Table2, Table2[PO], Table2[SO] )
)

It did not work for me maybe I did not enter it correctly, tried several times

@EugenioBeltran 
Would you please provide some screenshots for better understanding of the situation?

Here are the picture hope they are clear

IMG_20230424_213304173.jpg

IMG_20230424_213401470.jpg

  

IMG_20230424_213435830.jpg

IMG_20230424_213509421.jpg

@EugenioBeltran 

Seems like most of the columns in Table2 are calculated columns based on Table1. It is really difficult to detect the source of the circular dependency error(s) without working on the file itself. 

Can I share?

@EugenioBeltran 
Yes, you can use WeTransfer or any cloud service to share the download link

@EugenioBeltran 
I can see that there is no data model and the power pivot is empty!

Try this link pls 

 

https://docs.google.com/spreadsheets/d/1MWulNkfyjIZe2arO_wkMW5bf116EGfHp/edit?usp=drivesdk&ouid=1086....  

 

If this does not work, maybe send by e mail?

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.