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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ESS
Regular Visitor

Difference between SUM and value of differents models

Hello,
I need help to plan a check between two numbers on different models.
I have one Sharepoint extraction with this data:

 

YearWeekData
2021125
2021145
2021370
2020518
2020515

 

Where by using a slicer I check Years/Week Data SUM.

 

I also have another Sharepoint data list like this:

 

YearWeekData
20211200
20212

150

20203300
20214270
20205250

 

Is there a way to connect 2 models and have the difference between the SUM of the "Data" of the first Sharepoint list and the TOTAL of the single line by Year/Week on the second Sharepoint list?

 

Like:

200 - 25+45 (of the week 1 on year 2021) = 130

 

Thank you!

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @ESS 

 

To create  Year-Week calculated column in two tables:

Year-Week T1 = COMBINEVALUES("-",'T1'[Year],[Week])
Year-Week T2 = COMBINEVALUES("-",'T2'[Year],[Week])
 
Then to create a measure like this:
_diff =
VAR _sum =
    CALCULATE (
        SUM ( 'T1'[Data] ),
        FILTER ( 'T1', 'T1'[Year-Week T1] = MAX ( 'T2'[Year-Week T2] ) )
    )
RETURN
    SUM ( 'T2'[Data] ) - _sum

 

 

result:

vangzhengmsft_0-1630907428298.png

Please refer to the attachment below for details. Hope this helps.

 

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng
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-angzheng-msft
Community Support
Community Support

Hi, @ESS 

 

To create  Year-Week calculated column in two tables:

Year-Week T1 = COMBINEVALUES("-",'T1'[Year],[Week])
Year-Week T2 = COMBINEVALUES("-",'T2'[Year],[Week])
 
Then to create a measure like this:
_diff =
VAR _sum =
    CALCULATE (
        SUM ( 'T1'[Data] ),
        FILTER ( 'T1', 'T1'[Year-Week T1] = MAX ( 'T2'[Year-Week T2] ) )
    )
RETURN
    SUM ( 'T2'[Data] ) - _sum

 

 

result:

vangzhengmsft_0-1630907428298.png

Please refer to the attachment below for details. Hope this helps.

 

 

 

 

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

Thank you so much 🙂

amitchandak
Super User
Super User

@ESS , Create a common table for year week nad join with both of them

 

New table= distinct(union(summarize(Table1, Table1[Year],Table1[week]),summarize(Table2, Table2[Year],Table2[week])))

 

Create a new column in all three tables 

 

year week = [Year]*100 + [Week]

 

Join the new table with the other two and analyze it together 

 

new measure = sum(Table1[data]) -sum(Table2[Date])

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

Thanks for the answer.

I didn't understand how it work. Distinct formula remove duplicates but on there is Week 30 in 2020 and also in 2021. I'm sorry but I wrote just 2021 in my example but I have few years on the table.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors