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! Request now

Reply
FilipHanus
Helper I
Helper I

How to get the values of the past year

Hello,

I have this table.

FilipHanus_0-1718866601318.png

 

In this table, I have values ​​for the selected year 2025. For this year, it is the measure "Total Tržby SF nápočet" next to it I have values ​​for the year 2024 measure "Total Tržby SF nápočet Y-1 ". What I need to get is that in the third measure "Total Tržby SF nápočet Y-1 2"I need to get the values ​​from row 2023_06 from the measure "Total Tržby SF nápočet Y-1" for row 2024_06 Does anyone know how to do this please? I have already tried many measures but none of them gives the right result.

12 REPLIES 12
FilipHanus
Helper I
Helper I

Can anyone help me? 

Total Tržby SF nápočet y-1 2 = 
CALCULATE([Total Tržby SF nápočet Y-1], SAMEPERIODLASTYEAR('Calendar table'[Date]))

try it in the file I sent and you'll see that it just doesn't work!

I did try and it did seem to work as far as I could tell.  Can you provide a more simplified sample file that only focuses on the issue you are trying to solve?

Did you manage to find a solution? I have sent you the source file below

OneDrive (sharepoint.com) you can downloand file here

lbendlin
Super User
Super User

SAMEPERIODLASTYEAR will work for that.

That won't work. It can be applied to a contiguous series of data, but this is not a contiguous series of data. This is a combination of two dates: Year - sameperiotlastyear can be used, but it cannot be applied to the second date.

@FilipHanus Yes but you don't need to worry about contiguous data if you have a proper Date table and a relationship to the other table, SAMEPERIODLASTYEAR would work fine then.

I have a date table, but there is a relationship between sales and the date table. Column Year Month UZ OPP is a different table and it is not possible to do another realice because there would be ambiguity. Model is here. I am working with two dates. One date is date of sales and the second date is date of close opportunity.

FilipHanus_0-1718957566442.png

 

Avoid linking fact tables directly. Prefer to control them via dimension tables (like your calendar table).  Use USERELATIONSHIP and SAMEPERIODLASTYEAR as needed.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Report SalesForce Community.pbix Here is a link to the source file. The goal is to get in the table for line 2024_06 in the measure "Total Revenue SF calculated y-1 2" the value from line 2023_06 from the measure "Total Revenue SF calculated Y-1" and the same for the other lines. Measure Total Sales SF count Y-1" already shows last year's sales. I still need to shift the opportunity close date by a year.

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.