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
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.