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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
nikca
Regular Visitor

Sum by codebook

Hello guys, 

 

i have two tables: 

Table 1 
TextNumber
010010        10,5
011000           11
210100        250

 

 

Table 2 
CategoryText
010010010
011011000
210210100

 

In table 1, I using Measure, to sum all numbers related to text (text are more times in table). 

Table 2 is codebook to text. 

 

All i need is to get different for example between 010-011, which is -0,5. 

But, I don´t know how. 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @nikca 
You can achieve it using offset fumction

Ritaf1983_0-1687657430149.png

The steps :

Ritaf1983_1-1687657470280.png

2. Calculate basic sum

Sum_number = sum('Table'[Number])
3. Calculate your needed delta
ValuesDiff =
[Sum_number] - CALCULATE (
        [Sum_number],
        OFFSET ( -1, ALLSELECTED ( 'Table (2)'[Category] ), ORDERBY ( 'Table (2)'[Category], ASC ) )
    )
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @nikca 
You can achieve it using offset fumction

Ritaf1983_0-1687657430149.png

The steps :

Ritaf1983_1-1687657470280.png

2. Calculate basic sum

Sum_number = sum('Table'[Number])
3. Calculate your needed delta
ValuesDiff =
[Sum_number] - CALCULATE (
        [Sum_number],
        OFFSET ( -1, ALLSELECTED ( 'Table (2)'[Category] ), ORDERBY ( 'Table (2)'[Category], ASC ) )
    )
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.