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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
a22
Frequent Visitor

New table using values from two other tables

Hello,

 

I am working on analysing businesses' financial statements and need some help with writing DAX code to make a new table using values from another table, and names from another table. I already posted a similar question (New column in new table based on values of other tables ) but my problem has gotten a bit more complex so the solution there doesn't apply to this. Maybe @Mahesh0016 has an answer for this as well? 😄

 

Say I have two tables, Table 1 and Table 2.

 

Table 1 (which has info on shop names, year, the original line item name from each shop's financial statements and the value corresponding to that line item)

Shop nameYearLine item nameValue
Shop A2022current assets total10
Shop A2022non-current assets total20
Shop A2022current liabilities30
Shop B2022CA total40
Shop B2022NCA total50
Shop B2022CL total60
Shop B2021CA total70
Shop B2021NCA total80
Shop B2021CL total90

 

Table 2 (which has the original line item name and a new name for consistency)

Line item nameNew name
current assets totalTotal current assets
CA totalTotal current assets
non-current assets totalTotal non-current assets
NCA totalTotal non-current assets
current liabilities totalTotal current liabilities
CL totalTotal current liabilities

 

I want to use information from Tables 1 and 2 to ultimately get a table like this (let's call it Table 3):

 

Table 3

 

Shop nameYearTotal current assetsTotal non-current liabilitiesTotal current liabilities
Shop A2022102030
Shop B2022405060
Shop B2021708090

 

Many thanks in advance!

1 ACCEPTED SOLUTION

hi @a22 

something like this?

Table3 = 
ADDCOLUMNS(
    SUMMARIZE(
        Table1,
        Table1[Shop Name],
        Table1[Year]
    ),
    "Total current assets",
    CALCULATE(
        SUM(Table1[Value]),
        Table2[New Name]="Total current assets"
    ),
    "Total non-current assets",
    CALCULATE(
        SUM(Table1[Value]),
        Table2[New Name]="Total non-current assets"
    ),
    "Total current liabilities",
    CALCULATE(
        SUM(Table1[Value]),
        Table2[New Name]="Total current liabilities"
    )
)

FreemanZ_0-1683510537065.png

 

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @a22 

try to plot a matrix visual directly, like:

FreemanZ_0-1683508292942.png

or?

a22
Frequent Visitor

Thanks, that's a good idea! But I would prefer to do it without having to plot a visual....is there a way to just use DAX to make the table?

 

Reason is I need this table to add to my data model. If I were to plot a matrix visual I'd have to save it as a csv and then load that into my model which I'd rather avoid doing.

hi @a22 

something like this?

Table3 = 
ADDCOLUMNS(
    SUMMARIZE(
        Table1,
        Table1[Shop Name],
        Table1[Year]
    ),
    "Total current assets",
    CALCULATE(
        SUM(Table1[Value]),
        Table2[New Name]="Total current assets"
    ),
    "Total non-current assets",
    CALCULATE(
        SUM(Table1[Value]),
        Table2[New Name]="Total non-current assets"
    ),
    "Total current liabilities",
    CALCULATE(
        SUM(Table1[Value]),
        Table2[New Name]="Total current liabilities"
    )
)

FreemanZ_0-1683510537065.png

 

a22
Frequent Visitor

Thanks so much!

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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