Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I'm looking to generate a chart for YTD current year vs YTD last year. I have many values to calculate(Sales, Quantity, Per Country, Per State, Per Region etc.,). Each of this will be having a separate chart.
Can you please help me with a single variable to define YTD current year and another one to define YTD last year.
I would like to use this in the chart expressions.
Thanks,
Best Regards
Sai.
YTD Flag: if(if(Month(date(Floor(Date)))<=3,(Year(date(Floor(Date)))-1)&'-'&(Year(date(Floor(Date)))),(Year(date(Floor(Date))))&'-'&(Year(date(Floor(Date)))+1))=if(Month(((today())))<=3,(Year(((today())))-1)&'-'&(Year(((today())))),(Year(((today()))))&'-'&(Year(((today())))+1)),1,0) as YTD_Flag,
LYTD Flag: inyeartodate(Date, $(vDateToday), -1,4)* -1 AS LastYTDFlag
Try this in script make flag.In front end write expression as :
YTD =sum({<YTD={'1'}>} Sales)
LYTD =sum({<LYTD={'1'}>} Sales)
Hope this will helps u..!!
Regards,
Mohammad
It tried it with your example in a textbox, it worked...
try this
YTD:
=sum({<Date={">=$(=Yearstart(today()))<=$(today())"} >} Sales)
Y-1TD-1:
sum({<Date={">=$(=Yearstart(AddYears(today(),-1)))<=$(=AddYears(today(),-1))"} >} Sales)
Hello All,
Firstly thanks for all your suggestions.
This is turning out to be bit more complicated then i thought it would. So, here is what i'm looking to do.
Get YTD current year vales for each month.
I was able to achieve the YTD for my data upto May 31st(i.e., 1st Jan to 31st May) but it works only without the Month dimension in my chart.
Now, what i would like to have is to generate a value for each point mentioned above and have them with a month dimension.
NOTE: I believe that having date formulas would be better as i have many expressions(Sales and Quantity of three different types). I mean having a Date variable that would get me the Period from 1st Jan to 31st Jan and the next one to get Period from 1st Jan to 28th Feb and so on.
when you have multiple years why do use use month instead of yearmonth as dimension?
basically it should work with something like rangesum(above(sum(Sales),0,RowNo())
if YearMonth is the only dimension and YearMonth is sorted ascending.