cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rate Regular Visitor
Regular Visitor

Help with 2018 and 2019 comparison (with different months)

Hello!!

 

I have a project that started on July 2018, with daily data for sales. We would want to include a comarison with the sales for 2018 (July to December 2018) against the sales form 2019 (January up to today).

 

For 2019 data I am using the Quick Measure for Total Year To Date and everyhing works great.

However, I am struggling enormously with the formula for the data for 2018. I have tried the following:

1. Of course, if I include a hard coded 2018 as a condition in the Calculate, the filters don't work.

2. I have tried with SAMEPERIODLASTYEAR, as everyone recommends, but in my case, as I don't have data for a full year, is not viable.

3. I tried DATEADD from my Dates table, but I only get blanks.

    DATEADD(
        Date.[Date], -1, YEAR))

Do you have any suggestions on another method that I could use?

 

Thanks a lot and kid regards!!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help with 2018 and 2019 comparison (with different months)

Hi @Rate ,

As suggested, you could create a calendar table with CALENDARAUTO() and then you could create the measure like below.

2019 = TOTALYTD(SUM('Data'[Sales]),'Table'[Date])
2018 = var a =DATEADD('Table'[Date],-1,YEAR) return TOTALYTD(SUM('Data'[Sales]),a)

Here is the output.

Capture.PNG

You also could refer to my attachement.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Help with 2018 and 2019 comparison (with different months)

@Rate do you have date dimension in your model? if no you need to add one and  there are may posts on how to add one. Also make sure date dimension table is marked as date table .






Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Appreciate your Kudos Smiley Happy
Feel free to email me with any of your BI needs.





adityakommu Member
Member

Re: Help with 2018 and 2019 comparison (with different months)

Can you try this 

 

Measure=calculate( sum(sales),parellelperiod(Dimdate(date),-1,year))

Community Support Team
Community Support Team

Re: Help with 2018 and 2019 comparison (with different months)

Hi @Rate ,

As suggested, you could create a calendar table with CALENDARAUTO() and then you could create the measure like below.

2019 = TOTALYTD(SUM('Data'[Sales]),'Table'[Date])
2018 = var a =DATEADD('Table'[Date],-1,YEAR) return TOTALYTD(SUM('Data'[Sales]),a)

Here is the output.

Capture.PNG

You also could refer to my attachement.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Rate Regular Visitor
Regular Visitor

Re: Help with 2018 and 2019 comparison (with different months)

Hello Cherry,

 

Thank you very much!! Your solution was just amazing.

 

Thanks!

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 189 members 1,786 guests
Please welcome our newest community members: