Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I Need to set a Flag 1 for all the Years and Quarters which are less then Q22019.
I tried below thing but its not working
if(QuarterYear_New<=YearQuarter,1,0) as Year_Flag;
So for all the QuarterYears below Q22019 should be assign a Flag 1 less 0
Below is the Script:
YearQuarter:
load *,
if(QuarterYear_New<=YearQuarter,1,0) as Year_Flag;
load *,
PurgeChar(QuarterYear,' ') as QuarterYear_New,
'Q' & Ceil(Month(Date#(today(), 'M/D/YYYY'))/3)&Year(Date#(today(), 'M/D/YYYY')) as YearQuarter
Resident QuarterYear;
Drop Table QuarterYear;
Try this one once
if(Right(QuarterYear_New,4)>Right(YearQuarter,4) or (left(PurgeChar(QuarterYear_New,'Q'),1)>left(PurgeChar(YearQuarter,'Q'),1) and Right(QuarterYear_New,4)>=Right(YearQuarter,4)),0,1) as Year_Flag;
Hi Naveen,
Please try below logic
Load *,
if(right(QuarterYear_New,4)<=right(YearQuarter,4),1,0) as Year_Flag;
Regards,
Sultan
HI , your expression works only at Year Level ignoring Quarters , I Mean as shown below
Q32019 and Q42019 it suppose to be 0 instead of 1 because Q3 and Q4 is greater than Q2
Hello All , Any Suggestion for achieving above requirement plz
Try this one once
if(Right(QuarterYear_New,4)>Right(YearQuarter,4) or (left(PurgeChar(QuarterYear_New,'Q'),1)>left(PurgeChar(YearQuarter,'Q'),1) and Right(QuarterYear_New,4)>=Right(YearQuarter,4)),0,1) as Year_Flag;