cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Regular Visitor

## Sum by codebook

Hello guys,

i have two tables:

 Table 1 Text Number 010010 10,5 011000 11 210100 250

 Table 2 Category Text 010 010010 011 011000 210 210100

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
Super User

Hi @nikca
You can achieve it using offset fumction

The steps :

2. Calculate basic sum

Sum_number = sum('Table'[Number])
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
Super User

Hi @nikca
You can achieve it using offset fumction

The steps :

2. Calculate basic sum

Sum_number = sum('Table'[Number])
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

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors