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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
fksng66
Helper I
Helper I

SUM of coulmns in two different sheets

I have two different sheets imported and I would like to calculate the total sum value from these two columns

 

Let's say one of my sheet named Facebook, and another is PaidAd_FB, both contains the impressions column and I want to calculate the sum value of both. 

 

I tried to use this mesuare formula but doesn't work unfortunately.

SUM(Facebook[Impressions]) + SUM(PaidAd_FB[Impressions])
 
Did I miss out anything?
3 ACCEPTED SOLUTIONS

Hi @fksng66 ,

 

Here I suggest you to add a DimDate table and add a YearMonth column in both tables to help your calculation.

DimDate Table:

DimDate =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2024, 01, 01 ), DATE ( 2024, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "MonthNum", MONTH ( [Date] ),
    "Month", FORMAT ( [Date], "MMM" ),
    "YearMonth", FORMAT ( [Date], "YYYY-MMM" ),
    "YearMonthSort",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] )
)

Calculated Column:

In Facebook:

YearMonth = 
COMBINEVALUES("-",Facebook[Year],Facebook[Month])

In PaidAd:

YearMonth = 
COMBINEVALUES("-",PaidAd[Year],PaidAd[Month])

Result is as below.

vrzhoumsft_0-1724233825430.png

 

Best Regards,
Rico Zhou

 

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

Hi,

PBI file attached.  The Territory slicer should be dragged from a seperate Dim Table which should in turn be connect to the FB and PaidAd_FB tables.

Ashish_Mathur_0-1724299257257.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

okay it worked now, i've the territory (paidAd_fb) connected to territory (facebook) to form a many-to-many relationship and it's able to show the correct value for both organic and paid ads now

 

fksng66_3-1724315152239.png

fksng66_4-1724315205043.png

 

thanks again @Ashish_Mathur @v-rzhou-msft for the help!

 

View solution in original post

9 REPLIES 9
rajendraongole1
Super User
Super User

Hi @fksng66 The DAX formula you provided is correct for summing the values from the two columns in different tables, you can check on data types, column name that is reference form both tables along with relationship with right Facebook and PaidAd_FB or with other tables.

if there is any blanks , you can try below measure with colease function

Total Impressions =
SUMX(
Facebook,
COALESCE(Facebook[Impressions], 0)
) +
SUMX(
PaidAd_FB,
COALESCE(PaidAd_FB[Impressions], 0)
)

 

Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





hi @rajendraongole1 thanks for the reply. i've tried it but unfortunately doesn't seems to work as well.

 

i took the impressions value from the facebook and paidAd_fb and the total sum i got was supposed to be 90402 for NSEA on Jan month, but on my power bi chart it got more than 1.2m for just jan alone

fksng66_4-1724218073750.png

 

this is the data from the source file 

Facebook

fksng66_1-1724217604991.png

PaidAd_FB

fksng66_5-1724218232479.png

 

 

Hi @fksng66 ,

 

Here I suggest you to add a DimDate table and add a YearMonth column in both tables to help your calculation.

DimDate Table:

DimDate =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2024, 01, 01 ), DATE ( 2024, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "MonthNum", MONTH ( [Date] ),
    "Month", FORMAT ( [Date], "MMM" ),
    "YearMonth", FORMAT ( [Date], "YYYY-MMM" ),
    "YearMonthSort",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] )
)

Calculated Column:

In Facebook:

YearMonth = 
COMBINEVALUES("-",Facebook[Year],Facebook[Month])

In PaidAd:

YearMonth = 
COMBINEVALUES("-",PaidAd[Year],PaidAd[Month])

Result is as below.

vrzhoumsft_0-1724233825430.png

 

Best Regards,
Rico Zhou

 

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

 

@v-rzhou-msft I tried to replicate what you did there, but i got a very different kind of result tho

fksng66_0-1724297951203.png

Couldn't seem to find where I'm missing out

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

PBI file attached.  The Territory slicer should be dragged from a seperate Dim Table which should in turn be connect to the FB and PaidAd_FB tables.

Ashish_Mathur_0-1724299257257.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur Hi thanks for this, but the data for paid ads seems to be combining all the territories together for Jan month now, supposedly for NSEA Jan month the sum is 75447

 

fksng66_0-1724305700252.png

 

But now it's amost 200k for paid ads

fksng66_1-1724305746361.png

 

any idea as to why?

 

I tried to recreate one myself, I also noticed the icon for the date column is different from yours, not sure why is that so?

fksng66_2-1724309791601.png

 

 

okay it worked now, i've the territory (paidAd_fb) connected to territory (facebook) to form a many-to-many relationship and it's able to show the correct value for both organic and paid ads now

 

fksng66_3-1724315152239.png

fksng66_4-1724315205043.png

 

thanks again @Ashish_Mathur @v-rzhou-msft for the help!

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.