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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Powerbi_superus
Frequent Visitor

Show Quantity based on Item number another table

Hi All,

I am new to Power bi  and DAX

 

Hi   Table  A   WITH  SONUMBER ,ITEMNO 
       Table  B   WITH  SONUMBER, ITEMNO, Quantity
       Table A   and Table B have same SONUMBER  and ITEMNO .

I have to show up the Quantity of Table B with repective to SONUMBER ,ITEMNO OF Table A

 

Please let me know how we can dax to show quantity of Table B as there is  no join between ITEM NO of  TABLE A AND TABLE B.


Thank you all

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Powerbi_superus 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

TableA:

c1.png

TableB:

c2.png

 

There is no relationship between two tables. 

c3.png

 

You may create a measure like below.

Qty = 
SUMX(
    ADDCOLUMNS(
        TableA,
        "Result",
        CALCULATE(
            SUM(TableB[Quantity]),
            FILTER(
                ALL(TableB),
                [SoNumber]=EARLIER(TableA[SoNumber])&&
                [ItemNo]=EARLIER(TableA[ItemNo])
            )
        )
    ),
    [Result]
)

Or

Qty 2 = 
CALCULATE(
    SUM(TableB[Quantity]),
    TREATAS(TableA,TableB[SoNumber],TableB[ItemNo])
)

 

Result:

c4.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Powerbi_superus 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

TableA:

c1.png

TableB:

c2.png

 

There is no relationship between two tables. 

c3.png

 

You may create a measure like below.

Qty = 
SUMX(
    ADDCOLUMNS(
        TableA,
        "Result",
        CALCULATE(
            SUM(TableB[Quantity]),
            FILTER(
                ALL(TableB),
                [SoNumber]=EARLIER(TableA[SoNumber])&&
                [ItemNo]=EARLIER(TableA[ItemNo])
            )
        )
    ),
    [Result]
)

Or

Qty 2 = 
CALCULATE(
    SUM(TableB[Quantity]),
    TREATAS(TableA,TableB[SoNumber],TableB[ItemNo])
)

 

Result:

c4.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you Allan

amitchandak
Super User
Super User

@Powerbi_superus , refer if treatas can help

https://docs.microsoft.com/en-us/dax/treatas-function

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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