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
Anonymous
Not applicable

How to calculate a difference

Hello, I am new to Power BI, and I am trying to solve one (probably easy) task, but not sure how.

 

Let me simplify it:

 

I have data in such format:

YEAR   Company Result

2023      A             100

2022      B             150

2022      C             120

2021      D             250

2022      B               50

...

 

Then I already have a visual - table created:

       2021 - Result    2022 - Result    2023 - Result

A       0                         0                      100

B       0                        200                     0

C       0                        120                     0

D      250                      0                        0

Total  250                    320                    100

 

And I need to add one more column to this existing visual to calculate "Difference" 2023-2022. How can I do it, please?

 

Thanks.

Katarína

 

1 ACCEPTED SOLUTION
eliasayyy
Memorable Member
Memorable Member

Give you made a matrix table

 

Please try

 

Difference = 

VAR _y = [result]

VAR _ly = CALCULATE([result],calendar[year] = MAX(Calendar[year]) -1)

RETURN

_y - _yl

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

many thanks for your help!

eliasayyy
Memorable Member
Memorable Member

Give you made a matrix table

 

Please try

 

Difference = 

VAR _y = [result]

VAR _ly = CALCULATE([result],calendar[year] = MAX(Calendar[year]) -1)

RETURN

_y - _yl

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.