Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

based on selection cumulative total and previous year value show

Hi all,

 

I want to show previous year value and cummulative total in table fomat

 

i have source data year, month , i have concatenate year and month (Ex, September 2020),  if i select september 2020,  i need jan to sep2020 cummulative total value,  and previous year 2019 full year value 

 

sample data

 

YearMonthValueBusiness
2019jan73,431.49Allocated
2019april21,088.96Consumer
2019sep11,203.00Consumer
2019dec58.07Expenses
2020jan13,234.34Expenses
2020april75,690.32Allocated
2020sep17,817.28Consumer
2020Oct46.46Expenses
2018jan71,822.32Allocated
2018april18,293.38Consumer
2018sep69,064.75Expenses

 

 

 

if i select Sep2020,  i need cummulative total of jan2020 to sep2020 as a CY value ,  2019 jan to Dec value as a PY value

 

if i select Dec2019, i need cummulative total of jan to Dec2019 as a CY value then 2018 jan to dec as a PY value

 

output

 

 

 

how can I achieve this logic?

 

v-yingjl 

 

 

 

Thanks 

Rajesh

 

 

2 Replies

  • Strangely enough SAMEPERIODLASTYEAR() will give you _exactly_ what you need. Normally that is a nuisance when you want to compare year over year to date, but in your case that seems to be your desired outcome (full previous year).

  • Anonymous , Try Time intelligence with date table

     

    YTD Sales = CALCULATE(SUM(Table[Value]),DATESYTD('Date'[Date],"12/31"))
    Last YTD Sales = CALCULATE(SUM(Table[Value]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

     

    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.