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

conditional sum

hello

i have a table like this:

idd DaySales
1150
21100
3220
4250
53300
6320

i want to show the user sum of sales for the days befor than the day number he give as an input, i wrote it but it doesn't work :

Sum ({ <[Sales]={">=0"} ,  [d Day]={"$(<=CD)"}>}[Sales])

any one knows what is the problem?

thank you

azizi

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

What is CD? You might need [d Day]={"<=$(=CD)"}

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

14 Replies
ashfaq_haseeb
Champion III
Champion III

Hi,

Your request is not clear.

Can you explain what is the output you expect here.

Regards

ASHFAQ

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

What is CD? You might need [d Day]={"<=$(=CD)"}

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

sorry, the syntax i have wrote is this:

Sum ({ < [d Day]={"$(<=CD)"}>}[Sales])


and CD is an input value. i want just the sum of sales that are before than the day that user gives me as an input(CD).


Not applicable
Author

sorry, the syntax i have wrote is this:

Sum ({ < [d Day]={"$(<=CD)"}>}[Sales])


and CD is an input value. i want just the sum of sales that are before than the day that user gives me as an input(CD).

ashfaq_haseeb
Champion III
Champion III

Hi,

Try below

Sum ({ < [d Day]={"<=($(=(CD - 1))"}>}[Sales])


Regards

ASHFAQ

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Sum ({ <[Sales]={">=0"} ,  [d Day]={"<=($(=(CD - 1))"}>}[Sales])


OR


Sum ({ <[Sales]={">=0"} ,  [d Day]={"<($(=(CD))"}>}[Sales])


Regards,

Jagan.

Not applicable
Author

hi Ashfagh.

if the user give 3 as input i want to have sum of sales with [d Day]=1,2,3   and not just for [d Day]=2

i mean all the days before the day he gave as CD.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Then try this

Sum ({ <[Sales]={">=0"} ,  [d Day]={"<=($(=(CD))"}>}[Sales])


Regars,

Jagan.

ashfaq_haseeb
Champion III
Champion III

Try below

Sum ({ < [d Day]={"<=($(=(CD))"}>}[Sales])