Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hell Peeps,
while creating calendar itself i am loading the max date should be completed month( ex. today is 8/5/2022 its not a monthend date so i am taking previous monthend as maxdate in my calendar)
Load
min(Date) as minDate,
if(Today()=MonthEnd(Today()), Today(), MonthEnd(AddMonths(Today(),-1))) as maxDate
Resident [Data Analysis];
I have created a flag for YTD like below
YeartoDate(TempDate)*-1 as CurYTDFlag
expected result: 1/1/2022 to 7/31/2022 and its coming fine
coming to PYYTD its not working as expected
YeartoDate(TempDate,-1)*-1 as LastYTDFlag
if i use above im getting 1/1/2021 to 8/04/2021 that is not correct
as per my requirement i need to get the LYTD is : 1/1/2021 to 7/31/2021
Thanks in Advance !!
Regards,
Sra1..
i tried with below one, i am getting the expected result. like if current date is not equal to monthend data the it will provide the previous monthend date.
YearToDate((TempDate), -1,1,if(Today()=MonthEnd(Today()), Today(), MonthEnd(AddMonths(Today(),-1))))*-1 as LastYTDFlag
try
YearToDate(TempDate), -1, Month(Today())-1)*-1 as LastYTDFlag
Thanks for your response.
its not giving the expected output, it giving 7/1/2021 to 8/8/2021 only.
expected result is 1/1/2021 to 7/31/2021.
please try:
YeartoDate((TempDate,-1),MonthEnd(Month(Today())-1))*-1 as LastYTDFlag
thank you for the useful information
this expression is also not giving the expected result.
i tried with below one, i am getting the expected result. like if current date is not equal to monthend data the it will provide the previous monthend date.
YearToDate((TempDate), -1,1,if(Today()=MonthEnd(Today()), Today(), MonthEnd(AddMonths(Today(),-1))))*-1 as LastYTDFlag