Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Issues to filter Month

Hi Team, Can you please help me below query to filter Month, Baially i want to filter out current year snapshot with last year max month.

Last 5 Years = if(year(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT])=year(TODAY()) &&CA_LCR_LMS_HISTORY_001[ACQUIRED_DT]=MAX(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT]),1,

 

(if(year(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT]<YEAR(TODAY()) && MONTH(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT])="Dec"),1,0)))

 

 

 

  • Hey Anonymous ,

     

    Instead of 

    && MONTH(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT])="Dec"),1,0)))

    try:

    && Format(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT],"mmm")="Dec"),1,0)))

     

    Basically- the outcome of MONTH(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT])  will be a whole nu,ber month which you are trying to equate with a string value, hence the error

     

1 Reply

  • PC2790's avatar
    PC2790
    Community Champion

    Hey Anonymous ,

     

    Instead of 

    && MONTH(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT])="Dec"),1,0)))

    try:

    && Format(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT],"mmm")="Dec"),1,0)))

     

    Basically- the outcome of MONTH(CA_LCR_LMS_HISTORY_001[ACQUIRED_DT])  will be a whole nu,ber month which you are trying to equate with a string value, hence the error