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
Adore921
Frequent Visitor

Rolling YTD Revenue with a comparison of the same periods of past 2 years

Hi guys,

 

I have sales numbers per accounts per day of the last 3 years. And what I need to visualise is the comparison of the sum of sales up to the rolling date VS the same LYTD for 2021 VS 2020 of the same dates. 

 

ie. 

Totals only of these periods--->Jan 1st - To-same date as current (May 10)Jan 1st - To-same date as current (May 10)Jan 1st - To-date (May 10)
    
Customer Name202020212022
ASum Total SalesSum Total SalesSum Total Sales
BSum Total SalesSum Total SalesSum Total Sales
CSum Total SalesSum Total SalesSum Total Sales
DSum Total SalesSum Total SalesSum Total Sales

 

I can't make Parallelperiod() work to it... may you please kindly help?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Adore921 , Try like example with date table

try with year on column on matrix

calculate(Sum('order'[Qty]), filter('Date' , format('Date'[Date], "MMDD") <=  format(today(), "MMDD") ))

 

or

measures like

 

LYTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)

 

 

2nd Last YTD QTY forced=
var _max = date(year(today())-2,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-2,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)

 

 


YTD QTY forced=
var _max1 = today() //or maxx(allselected('Order'),'order'[Date])
var _max = format(_max,"MMDD")
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date', format('Date'[Date],"MMDD")<=_max))

 

 

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Adore921 , Try like example with date table

try with year on column on matrix

calculate(Sum('order'[Qty]), filter('Date' , format('Date'[Date], "MMDD") <=  format(today(), "MMDD") ))

 

or

measures like

 

LYTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)

 

 

2nd Last YTD QTY forced=
var _max = date(year(today())-2,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-2,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)

 

 


YTD QTY forced=
var _max1 = today() //or maxx(allselected('Order'),'order'[Date])
var _max = format(_max,"MMDD")
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date', format('Date'[Date],"MMDD")<=_max))

 

 

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.