Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I am unable to get the YTD Value . Please help me here Sample data is attached.
Load ID, YearMonth, Sales, if(YearMonth <= Year(Today())*100 + Month(Today()) AND YearMonth >= Year(Today())*100, 1) as YTD_Flag From YourTable;
To sum, then use Sum({< YTD_Flag = {1} >}Sales)
You could also write the same code into your set analysis but if you plan to use it for other fields, it's often better to create a flag in the script, so that's what I suggested.
Note that this assumes the current month is included in the YTD calculation. If you only want completed months (e.g. currently September would be included and October would not), replace the <= with a < in the first section of the if() statement.