Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date If Condition

Dear all,

I have used the following expression for the calculation. Kindly go through the attached file.

Sum(if(Date(SALEDATE,'DD/MM/YYYY')=Date(UPDATE,'DD/MM/YYYY'),RATE))

I am not getting the result because SALEDATE is a normal Date Field and UPDATE field format is (DD/MM/YYYY hh:mm:ss), from this field i have taken Date alone for the above expression.

And another condition for the above expression is if the Updatetime is < 12PM it should be AM Rate and if it is >12 PM it should be PM Rate.

Waiting for the reply.

Regards,

Sivasu

2 Replies
MK_QSL
MVP
MVP

Load your table as below

DATETIME:

Load

  RowNo() as ID,

  CODE,

  Date(SALEDATE) as SALEDATE,

  Timestamp#(UPDATE,'DD/MM/YYYY hh:mm:ss') as UPDATE,

  RATE

From ......

Now use below expressions

Sum(if(Date(SALEDATE,'DD/MM/YYYY')=Date(Floor(UPDATE),'DD/MM/YYYY'),RATE))

if(Date(SALEDATE,'DD/MM/YYYY')= Date(Floor(UPDATE),'DD/MM/YYYY') and Time(FRAC(UPDATE),'hh') >= '12', 'PM',

if(Date(SALEDATE,'DD/MM/YYYY')= Date(Floor(UPDATE),'DD/MM/YYYY') and Time(FRAC(UPDATE),'hh') < '12', 'AM',

'NOT MATCHING'))

Not applicable
Author

Hi Siva,

Please find the attachment.

Thanks,

Vamsi