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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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...


@ 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!:
The Definitive Guide to Power Query (M)

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


@ 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!:
The Definitive Guide to Power Query (M)

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors