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! Learn more

Reply
Anonymous
Not applicable

Table transformation logic in power bi

3tables.PNGIn In my business logis sales are happening in 3 phases, first customer order will come in to the inbound after production it moves in to outbound and at last it reached in the completed(Day Sale). How to achieve if it moves from inbound to outboud the sales order and line should not exist in the inbound, if it moves from outbound to complete it should not exist in the outbound, how i can achieve this in power bi transformation table. depending on the sales order and line it is moving throuhg the phases.

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

I create a simple .pbix file. Please check if this is what you want.

 

1. Import your data.

2. Create another 3 tables like so:

 

let
    Source = #"Inbound",
    #"Filtered Rows" = Table.SelectRows(Source, each ([status] = "Inbound"))
in
    #"Filtered Rows"

 

inbound - desired.JPG

 

 

let
    Source = #"Inbound",
    OnlyIncludeOutbound = Table.SelectRows(Source, each ([status] = "Outbound")),
    AppendOutbound = Table.Combine({OnlyIncludeOutbound, #"Outbound"}),
    ReturnOutbound = Table.SelectRows(AppendOutbound, each ([status] = "Outbound"))
in
    ReturnOutbound

 

outbound - desired.JPG

 

 

let
    Source = #"Outbound",
    OnlyIncludeCompleted = Table.SelectRows(Source, each ([status] = "Completed")),
    AppendCompleted = Table.Combine({OnlyIncludeCompleted, #"Completed"}),
    ReturnCompleted = Table.SelectRows(AppendCompleted, each ([status] = "Completed"))
in
    ReturnCompleted

 

completed - desired.JPG

 

2. Uncheck "Enable load" of each original table.

Icey_0-1604477411931.png

 

For more details, please check the attached .pbix file.

 

 

Best regards

Icey

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

4 REPLIES 4
msksenthil
Helper III
Helper III

@Anonymous 

I believe you have unique fields like customer_id/sales_id and date_field in all the tables

With that, you can merge the tables from the 'Inbound' table to the 'Outbound' table and to the 'Completed' table

And expand table particularly the date from each table

So the final table has all the 3 dates

Disable load the other 3 tables

Create a custom column based on the 3 dates to find the record is Inbound/Outboud/Completed

 

finally, you can create a measure based on a custom column and find the number of orders

 

Here the M-code for Merge/final table

let
Source = Table.NestedJoin(Inbound, {"customer order", "saleorder"}, Outbound, {"customer order", "saleorder"}, "Outbound", JoinKind.LeftOuter),
#"Expanded Outbound" = Table.ExpandTableColumn(Source, "Outbound", {"out_createddate"}, {"out_createddate"}),
#"Merged Queries" = Table.NestedJoin(#"Expanded Outbound", {"customer order", "saleorder"}, Completed, {"customer order", "saleorder"}, "Completed", JoinKind.LeftOuter),
#"Expanded Completed" = Table.ExpandTableColumn(#"Merged Queries", "Completed", {"comp_createddate"}, {"comp_createddate"}),
#"Added Custom" = Table.AddColumn(#"Expanded Completed", "Custom", each try if Int64.From([comp_createddate]) > 0 then "Completed" else "no" otherwise try if Int64.From([out_createddate]) > 0 then "Outbound" else "Inbound" otherwise "Inbound")
in
#"Added Custom"

 

 

Please share your results

Icey
Community Support
Community Support

Hi @Anonymous ,

 

I create a simple .pbix file. Please check if this is what you want.

 

1. Import your data.

2. Create another 3 tables like so:

 

let
    Source = #"Inbound",
    #"Filtered Rows" = Table.SelectRows(Source, each ([status] = "Inbound"))
in
    #"Filtered Rows"

 

inbound - desired.JPG

 

 

let
    Source = #"Inbound",
    OnlyIncludeOutbound = Table.SelectRows(Source, each ([status] = "Outbound")),
    AppendOutbound = Table.Combine({OnlyIncludeOutbound, #"Outbound"}),
    ReturnOutbound = Table.SelectRows(AppendOutbound, each ([status] = "Outbound"))
in
    ReturnOutbound

 

outbound - desired.JPG

 

 

let
    Source = #"Outbound",
    OnlyIncludeCompleted = Table.SelectRows(Source, each ([status] = "Completed")),
    AppendCompleted = Table.Combine({OnlyIncludeCompleted, #"Completed"}),
    ReturnCompleted = Table.SelectRows(AppendCompleted, each ([status] = "Completed"))
in
    ReturnCompleted

 

completed - desired.JPG

 

2. Uncheck "Enable load" of each original table.

Icey_0-1604477411931.png

 

For more details, please check the attached .pbix file.

 

 

Best regards

Icey

 

If this post helps,then consider Accepting it as the solution to help other members find it faster.

amitchandak
Super User
Super User

@Anonymous , Is that not happening in your source system

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

No, its not happening in our source system, this should implement by using the power bi logic. the shared youtube videos not discussing this logic.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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