- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Comparing this year YTD vs last year YTD
Hello helpful community!
I am struggeling with comparing the total sales of two years, YTD 2019 vs YTD 2018. My total sales measure seams to be completely fine, however, I can not get the data to show ytd 2019 compared to the same ytd 2018 period. I have tried almost every video suggestion on youtube and every post here in the forum, but without success.
In the pics below I have used the 'sameperiodlastyear' function. Anyone who can help me out?
Ps. 'totale omzet' = total sales, I adjusted the header in the table.
Kind regards,
Bas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I am using Sample Adventure Works data. Pls try using this measure & check the relationship between fact table & date table.
Let me know if this solves your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply
The formula seems to be working fine and the dates seem to have the correct relationship (Datuminvoiced & Datum ISO). But when I put the formula into the table, it displays the warning: "cant't display the visual". Total sales is defined as: "sum(DATAINPUT_POWERBI_1_2019[omzet]) just like in th formula: "totalsalesPYYTD". On itself, it sums the revenue perfectly but when couples with the new measure it doesn't work for some reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you have continuous dates. In case some dates are missing sameperiodlastyear might not work fine
In such case you to have try formula like
On the Fly Change % = Var _last_year= (max('Date'[Date Filer]))-365 Var _This_year=year(max('Date'[Date Filer])) Var _min_last_year= (maxx('Date',STARTOFYEAR(DATEADD('Date'[Date Filer],-12,MONTH)))) Var _min_This_year=year(max(STARTOFYEAR('Date'[Date Filer]))) Var _last_year_val= CALCULATE(sum(Sales[Sales Amount]),(Sales[Sales Date])<=_last_year && (Sales[Sales Date]) >=_min_last_year) Var _This_year_val =CALCULATE(sum(Sales[Sales Amount]),(Sales[Sales Date])<=_This_year && (Sales[Sales Date]) >=_min_This_year) return (_This_year_val-_last_year_val)/_last_year_val*100
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you pls try creating the relationship between those two columns using date column (of datatype date) instead of datekey column.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you show us the Table Schema. Also, Is Datum the Date Table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Datum is indeed the date table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Instead of SAMEPERIODLASTYEAR(), Can you try using DATEADD(Date[Date],-1,Year)
Best Regards,
Vignesh M
If what I suggested worked for you feel free to Drop a "Kudos" and Consider to "Accept as Solution" if I solved your Issue 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply. Still no success unfortunately, both the formulas don't seem to work properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay just realized the bracket issue and I got the formula to work but the table doens't display the values I'd like to see.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you share this PBIX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately, due to company policy and sensitive data, I cannot and am not allowed to externally share the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
There is a Bracket issue. Include another Simple Bracket at the End
Best Regards,
Vignesh M
If what I suggested worked for you feel free to Drop a "Kudos" and Consider to "Accept as Solution" if I solved your Issue 🙂

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
06-24-2024 12:18 PM | |||
09-05-2024 12:38 PM | |||
11-20-2024 01:52 AM | |||
01-17-2025 02:55 PM | |||
04-24-2024 10:22 AM |
User | Count |
---|---|
87 | |
81 | |
53 | |
38 | |
35 |