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
HamidBee
Power Participant
Power Participant

How do I make a new column from two different tables?

How do I create a new table?. The table will be made by subtracting two columns from two different tables?. These are the two tables I am trying to subtract:

 

Table Subtraction.png

 Any help is appreciated. 

5 REPLIES 5
amitchandak
Super User
Super User

@HamidBee , You need to have common dimensions like Attributes and can have measure like and analyze against common dimensions

 

Sum(2020[value]) -sum(2021[value])

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

They should have the same months and values if one was to analyze it row by row. Is that what you mean by common dimensions? Also is there a specific DAX code that is used for subtracting columns like this.

@HamidBee , You have a calendar table, In that, you should have a month (without year) to compare against month

 

You should prefer measure to subtract data across two tables

 

Bridge Table: https://www.youtube.com/watch?v=Bkf35Roman8&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=19

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

I was thinking to do a measure. But I really would like the difference to be inside a table because I plan to create a colour field. If I can get this calculcation onto a table it would make things alot simpler for me long term. Should I make a measure then put the measure into a table seperated by months. 

Anonymous
Not applicable

Hi @HamidBee ,

 

Can you provide some dummy data?

 

If it is the following data.

vstephenmsft_4-1641194632975.png

vstephenmsft_5-1641194637374.png

 

Here's the solution.

1.Create a month column in both tables.

Month = FORMAT([Dates],"MMM")

vstephenmsft_6-1641194924631.png

vstephenmsft_7-1641194930824.png

 

2.Create a measure.

Difference = 
VAR _20 =
    SUM ( '2020'[Value] )
VAR _21 =
    CALCULATE (
        SUM ( '2021'[Value] ),
        FILTER (
            '2021',
            [Attribute] = MAX ( '2020'[Attribute] )
                && [Month] = MAX ( '2020'[Month] )
        )
    )
RETURN
    _20 - _21

 

3.Results.

vstephenmsft_8-1641194967118.png

 

Best Regards,

Stephen Tao

 

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

 

 

 

 

 

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