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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Nick2358
Helper III
Helper III

Date measure 2 months ago (2020 data in 2021) Year -1 (2019)

Hello everyone,

 

Here is my problem today.

 

I have the measure below:

 

2020_2_Months_Ago =
var current_month = eomonth(TODAY(),-2)
return CALCULATE(SUM('Conso Bdgt 2020'[SUM]), FILTER('Dates', eomonth('Dates'[Date],0) = current_month))
 
I give me numbers that we track monthly that's 2 months back (since we are in January 2021 it's the number from November 2020).
However we compare it we the previous year number (which is 2019 but we are in 2021) and I can't find the solution even after trying a couple of things.
 
I'm pretty sure there is a "Year() -1" to be added somewhere but can't find how... 
Also once we get in March 2021 would the solution still work to have 2020 number (and not 2019 anymore).
 
I hope that makes sense,
 
Thanks in advance for your help,
 
Nick
1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Nick2358 

You can use the time intelligence function to achieve it, try the following measure You can change the number of months as necessary, I have entered -2. If you need 14 months back,m add -14.

2020_2_Months_Ago = 
CALCULATE(
    SUM('Conso Bdgt 2020'[SUM]), 
    DATEADD(
        'Dates'[Date],
        -2,
        MONTH 
    )
)

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@Nick2358 

You can use the time intelligence function to achieve it, try the following measure You can change the number of months as necessary, I have entered -2. If you need 14 months back,m add -14.

2020_2_Months_Ago = 
CALCULATE(
    SUM('Conso Bdgt 2020'[SUM]), 
    DATEADD(
        'Dates'[Date],
        -2,
        MONTH 
    )
)

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

hi @Fowmy ,

 

Can't believe I didn't think about it,

 

Thanks a lot for your help!

 

Nick

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.