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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
erhan_79
Post Prodigy
Post Prodigy

creating table help

Hi there ;

 

İ nned your kind help abou below issue pls , I have two table Table A and Table B,

  • Table A gives stock quantities based on warehouse location and material ,
  • Table B gives delivered quantities based on warehouse location  and material , You can see below that 2 tables 

 

Capture1.JPG

 

 

 

 

so i would like  to take difference between stock and delivered quantities but based on specific 3 warehose locations . These locations are "Location1" , "Location2" , "Location3" .I want to create a new table which is calling " Table C " , will give me difference of the stock quantity and delivered Quantity between Table A and Table B .You can see sample created Table C that i wanted as below .Also i am sharing a link about sources as below to make your job easy :).Thanks in advance dears.

 

Capture2.JPG

 https://drive.google.com/file/d/1ii6MU0tOx2V9kjivL8DJW8U_z2TJlPD-/view?usp=sharing

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

@erhan_79 

Or if you wanted to create the table in DAX:

TableC V2 = 
SUMMARIZECOLUMNS (
    TableA[Material],
    TableA[Warehouse Location],
    "Difference quantity",
        VAR aux_ =
            SUM ( TableA[Stock Quantity] )
                - CALCULATE (
                    SUM ( TableB[Delivered Quantity] ),
                    TREATAS (
                        SUMMARIZE ( TableA, TableA[Material], TableA[Warehouse Location] ),
                        TableB[Material],
                        TableB[Warehouse Location]
                    )
                )
        RETURN
            IF ( aux_ = 0, BLANK (), aux_ )
)

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

@erhan_79 

Or if you wanted to create the table in DAX:

TableC V2 = 
SUMMARIZECOLUMNS (
    TableA[Material],
    TableA[Warehouse Location],
    "Difference quantity",
        VAR aux_ =
            SUM ( TableA[Stock Quantity] )
                - CALCULATE (
                    SUM ( TableB[Delivered Quantity] ),
                    TREATAS (
                        SUMMARIZE ( TableA, TableA[Material], TableA[Warehouse Location] ),
                        TableB[Material],
                        TableB[Warehouse Location]
                    )
                )
        RETURN
            IF ( aux_ = 0, BLANK (), aux_ )
)

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

AlB
Community Champion
Community Champion

Hi @erhan_79 

You can do this best in Power Query. Place the following M code in a blank query to see the steps for Table C (it assumes TableA and TableB in place as shown above):

 

let
    Source = Table.NestedJoin(TableA, {"Material", "Warehouse Location"}, TableB, {"Material", "Warehouse Location"}, "TableB", JoinKind.LeftOuter),
    #"Expanded TableB" = Table.ExpandTableColumn(Source, "TableB", {"Delivered Quantity"}, {"Delivered Quantity"}),
    #"Added Custom" = Table.AddColumn(#"Expanded TableB", "Difference quantity", each [Stock Quantity]-[#"Delivered Quantity"], type number),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Difference quantity] <> 0)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Stock Quantity", "Delivered Quantity"})
in
    #"Removed Columns"

 

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.