Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

YTD Calculation

Hi ,

I need to compare this year YTD with Lastyear YTD sales.

Date= SoldDate

Ex:Untitled.png

Thanks..

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Sum({<SoldDate = {

"$(='>=' & Date(YearStart(Max(SoldDate), 0), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), 0), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -1), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -1), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -2), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -2), 'M/D/YYYY'))",

"$(='>=' & Date(YearStart(Max(SoldDate), -3), 'M/D/YYYY') & '<=' & Date(AddYears(Max(SoldDate), -3), 'M/D/YYYY'))"

}, SoldMonth, SoldYear>}ESTCUST)


Capture.PNG

View solution in original post

21 Replies
Anil_Babu_Samineni

Create Straight table and the use these expressions and use dim as Product

2017(YTD)

Sum({<Year={'Only({<Year = {'$(=Max(Year))'}>}Year)'}, Month=, Quarter=, Week=,  SoldDate={">=$(=Num(YearStart(Max(SoldDate))))<=$(=Max(SoldDate))"}>} Sales)


2016(YTD)

Sum({<Year={'Only({<Year = {'$(=Max(Year)-1)'}>}Year)'}, Month=, Quarter=, Week=,  SoldDate={">=$(=Num(YearStart(Max(SoldDate))))<=$(=Max(SoldDate))"}>} Sales)


2015(YTD)

Sum({<Year={'Only({<Year = {'$(=Max(Year)-2)'}>}Year)'}, Month=, Quarter=, Week=,  SoldDate={">=$(=Num(YearStart(Max(SoldDate))))<=$(=Max(SoldDate))"}>} Sales)


2014(YTD)

Sum({<Year={'Only({<Year = {'$(=Max(Year)-3)'}>}Year)'}, Month=, Quarter=, Week=,  SoldDate={">=$(=Num(YearStart(Max(SoldDate))))<=$(=Max(SoldDate))"}>} Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

More like this

Max Year

Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date), 0), 'MM/DD/YYYY') & '<=' & Date(AddYears(Max(Date), 0), 'MM/DD/YYYY'))"}, Month, Year, Quarter, Week, Year>}Sales)

Max Year - 1

Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date), -1), 'MM/DD/YYYY') & '<=' & Date(AddYears(Max(Date), -1), 'MM/DD/YYYY'))"}, Month, Year, Quarter, Week, Year>}Sales)


Max Year - 2

Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date), -2), 'MM/DD/YYYY') & '<=' & Date(AddYears(Max(Date), -2), 'MM/DD/YYYY'))"}, Month, Year, Quarter, Week, Year>}Sales)


Max Year - 3

Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date), -3), 'MM/DD/YYYY') & '<=' & Date(AddYears(Max(Date), -3), 'MM/DD/YYYY'))"}, Month, Year, Quarter, Week, Year>}Sales)

I have assumed your date to be in the format MM/DD/YYYY, but if it is in another format, please change the expression accordingly to change all MM/DD/YYYY to your actual date formats.

nareshthavidishetty
Creator III
Creator III
Author

Thanks..

Can we get in single expression.

Ex:

2017 - 233

2016- 334

Thanks..

nareshthavidishetty
Creator III
Creator III
Author

Hi,

I have to show as below format.ow to get this i single expression.

Untitled.png

Thanks..

nareshthavidishetty
Creator III
Creator III
Author

Hi Sunny,

Can we get with in one expression.

Thanks..

sunny_talwar

We might be able to, but I would need to look at what you have.... would you be able to share a sample?

nareshthavidishetty
Creator III
Creator III
Author

Hi,

After using the 4 expressions i got below result.Which is not correct.

I need to show in single column.

EX:For state Albuqerque.

Untitled.png

sunny_talwar

Can you attach you qvw?

nareshthavidishetty
Creator III
Creator III
Author

Hi,

Please find the attached is the application.

Thanks..