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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bininja
Helper I
Helper I

Compare YTD to same dates last year

Hi guys,

 

I am trying to create a barchart where I would like to show sales per month for current year with comparison to same period last year, with the possibility to drilldown to per day. The difficulty I am having is to be able to compare current month to same dates for last year current month. It sums up the whole month for last year which makes it wrong.

 

I have a Calendar table but I can not use it as a slicer and use SAMEPERIODLASTYEAR as I cannot add date-slicer to the report as it is supposed to be sent out on emails.

 

 

Any help is appriciated.

 

Annotation 2020-03-30 160038.png

Samle file: https://easyupload.io/0x3jpg 

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thanks for your quick reply. Unfortunately your solution does not look to cover my problem. I am looking for a solution on date-level but your solution look to be on month level.

TITHW covers a general technique around date filtering so the basic concept can be used for any situation. However, it is not really possible to cover the nearly limitless permutations. If you could share sample data I could be more specific. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler I got it sorted out by using filter and variables. Thanks for your time 🙂

 

 

@Greg_Deckler Thanks. I just added a sample file to my post. Please take a look. I am looking to distinctCount the visitorIds.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.