Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
MauriceLudo
Creator II
Creator II

Date Condition

Hi,

Please I would like to calculate the sum of sales before and after March 2018:

- if date > March 2018 : sum({<[Produits/Services]={'NSS & CCD '}>}[VENTE PRIS])

- if Date < March 2018 : sum({<[Produits/Services]={'NSS'}>}[VENTE PRIS])


please what is the best solution

Thank you

Best regards

Maurice

5 Replies
YoussefBelloum
Champion
Champion

Hi,

you can try this:

sum({<[Produits/Services]={'NSS & CCD '},DATE_FIELD={"<032018"}>}[VENTE PRIS])


but before doing this, you should know the format of your date field, example


1. if your date field format is: DD/MM/YYYY:


sum({<[Produits/Services]={'NSS & CCD '},DATE_FIELD={"<01/03/2018"}>}[VENTE PRIS])


2. if your date field format is: MMYYYY


sum({<[Produits/Services]={'NSS & CCD '},DATE_FIELD={"<032018"}>}[VENTE PRIS])


Also, your date field must be evaluated as a date




MauriceLudo
Creator II
Creator II
Author

Thank you,

but for the seconde condition

if Date > March 2018 : sum({<[Produits/Services]={'NSS'}>}[VENTE PRIS])

how to do?

YoussefBelloum
Champion
Champion

Same as above, just replace < by >

example:

sum({<[Produits/Services]={'NSS & CCD '},DATE_FIELD={">032018"}>}[VENTE PRIS])

MauriceLudo
Creator II
Creator II
Author

if date > March 2018 : sum({<[Produits/Services]={'NSS & CCD '}>}[VENTE PRIS])

- if Date < March 2018 : sum({<[Produits/Services]={'NSS'}>}[VENTE PRIS])

YoussefBelloum
Champion
Champion

ah sorry, I didn't pay enough attention on this one, so try this:

sum({<[Produits/Services]={'NSS'},DATE_FIELD={">032018"}>}[VENTE PRIS])