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
hidenseek9
Post Patron
Post Patron

How to append calculated column from one table with another table?

Hello Power BI Community,

 

I need a help with appending two tables together.

What I would like to do is to append a calculated column from one table to another.

Sample Power BI

 

In the attached BI, I have "Demand" table.

In it, I calculated gross sales as a calculated column as below screenshot.

(Demand cab)

Demand CAB.JPG

 

In PL by SKU table, I have actual gross sales data as per below.

PL by SKU.JPG

 

I would like to append these two tables including "demand cab" calculated column

and sort out by "SKU name Final", which is in "SAP Code Mapping" table.

The relationship is already created.

 

I would like to have a new table with SKU Name Final and gross sales information.

then I would like to put other calculated columns in the new table to calculate down to net sales.

 

If you can help with this, this is much appreciated.

Many thanks,

 

H

1 ACCEPTED SOLUTION

Hi @hidenseek9,

 

I get it now. Try these table formulas, please.

Table =
DISTINCT (
    UNION (
        SELECTCOLUMNS (
            Demand,
            "SKU Name Final", [SKU Name Final],
            "Date", [Date],
            "Sequence", [Sequence],
            "Gross Sales", [Demand Cab]
        ),
        SELECTCOLUMNS (
            'PL by SKU',
            "SKU Name Final", [SKU NAME],
            "Date", [Date],
            "Sequence", [Sequence],
            "Gross Sales", [GS - Gross Sales]
        )
    )
)

Or,

Table =
UNION (
    SELECTCOLUMNS (
        Demand,
        "SKU Name Final", [SKU Name Final],
        "Date", [Date],
        "Sequence", [Sequence],
        "Gross Sales", [Demand Cab]
    ),
    SELECTCOLUMNS (
        'PL by SKU',
        "SKU Name Final", [SKU NAME],
        "Date", [Date],
        "Sequence", [Sequence],
        "Gross Sales", [GS - Gross Sales]
    )
)

How-to-append-calculated-column-from-one-table-with-another-table2

 

Best Regards,
Dale

Community Support Team _ Dale
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

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @hidenseek9,

 

Is the NEW table in the snapshot what you'd like? Please don't share sensitive data due to it's public here.

Table =
ADDCOLUMNS (
    SUMMARIZE ( 'SAP Code Mapping', 'SAP Code Mapping'[SKU Name Final] ),
    "Gross Sales", CALCULATE ( SUM ( 'PL by SKU'[GS - Gross Sales] ) ),
    "Demand cab", CALCULATE ( SUM ( Demand[Demand Cab] ) )
)

How-to-append-calculated-column-from-one-table-with-another-table

 

Best Regards,
Dale

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

@v-jiascu-msft

 

Thank you for your quick response.

What I would like to achieve is that,

Final Outcome Columns

 

Sorry I was not clear.

 

2018-10-30 15_11_57-181030_Final Outcome columns.xlsx - Excel.png

 

Basically, "Demand cab" from Demand tab is gross sales and Gross Sales from PL by SKU tab is gross sales,

so I would like to bring both of them in one column.

 

Many thanks,

 

Hi @hidenseek9,

 

I get it now. Try these table formulas, please.

Table =
DISTINCT (
    UNION (
        SELECTCOLUMNS (
            Demand,
            "SKU Name Final", [SKU Name Final],
            "Date", [Date],
            "Sequence", [Sequence],
            "Gross Sales", [Demand Cab]
        ),
        SELECTCOLUMNS (
            'PL by SKU',
            "SKU Name Final", [SKU NAME],
            "Date", [Date],
            "Sequence", [Sequence],
            "Gross Sales", [GS - Gross Sales]
        )
    )
)

Or,

Table =
UNION (
    SELECTCOLUMNS (
        Demand,
        "SKU Name Final", [SKU Name Final],
        "Date", [Date],
        "Sequence", [Sequence],
        "Gross Sales", [Demand Cab]
    ),
    SELECTCOLUMNS (
        'PL by SKU',
        "SKU Name Final", [SKU NAME],
        "Date", [Date],
        "Sequence", [Sequence],
        "Gross Sales", [GS - Gross Sales]
    )
)

How-to-append-calculated-column-from-one-table-with-another-table2

 

Best Regards,
Dale

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

@v-jiascu-msft

 

Thank you so much! Works perfectly!

 

H

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.