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
Paulyeo11
Impactful Individual
Impactful Individual

How to using Rolling expression to get jan 2019 till dec 2019 sales amount ?

Hi All

 

Below is my expression working fine , it return 9550 amount  , which is last 12 month sales from today date , in case the today 2021 Jan it will capture next 12 month sales amount .

 

Rolling 12 = CALCULATE(sum(SALES[sales]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))

 

Paulyeo11_0-1608677984147.png

 

Now i need expression to get the next 12 month sales from Dec 2019 - Jan 2019 :-

 
 

Paulyeo11_0-1608678292611.png

 

https://www.dropbox.com/s/7vs0iks8pswbqjy/Rolling%20month%20for%20compute%20sales%20changes.pbix?dl=...

 

Above link is my PBI file 

 

Paul

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Paulyeo11 , Try like

 

Last 12 before 12  = CALCULATE(SUM(Sales[Net Sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Paulyeo11 ,

 

Please let us know if the replies above are helpful.

 

If they are, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If not, please give us more details.

 

 

Best Regards,

Icey

amitchandak
Super User
Super User

@Paulyeo11 , Try like

 

Last 12 before 12  = CALCULATE(SUM(Sales[Net Sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))
amitchandak
Super User
Super User

@Paulyeo11 , I am assuming you need 12 before 12.

So these are last 12

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

These are 12 before 12

 

Rolling 12 till last 12 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],-12,month)),-12,MONTH))
Rolling 12 till last 12 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(dateadd(Sales[Sales Date],-12,month)),-12,MONTH))
Rolling 12 till last 12 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(dateadd('Date'[Date],-12,month)),-12,MONTH))

 

 

2nd last year

2nd Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
2nd Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-2,Year)),"12/31"))

Hi Amit

 

You provide me the beow expression is what i need , it does not have any error , but it display null

_Roll next12 = CALCULATE(sum(SALES[sales]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(SALES[date],-12,month)),-12,MONTH))

Paulyeo11_0-1608694507641.png

 

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.