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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

User field depended condition in expression

Hi,

I have list with dates and diagram where I need to get sum of values where date less or equal to date selected in list box.

for example:

I have data like this

data.date

data.value

the list shows data.date in month format

the expression in diagram I need is somthing like:

Sum(

    if(

          data.date <= (valueSelectedInList),

          ByMonthPlan.Value,

          0)

)

If anyone know the way how to do it, please help.

1 Solution

Accepted Solutions
Not applicable
Author

I added variable selectedDateString '=(max({dateState}data.date))'

and the expressions:

Sum( TOTAL

    if(

        data.date <= selectedDateString,

        data.Value,

        0

    )

do work

View solution in original post

3 Replies
Not applicable
Author

Could you try:

Sum(

    if(

          data.date = (GetFieldSelections(Items.Code)),

          ByMonthPlan.Value,

          0)

)

Not applicable
Author

Yes, I was tryed GetFieldSelections() with various arguments but I can't get any value.

Now I find way to get selected value but still can't use it in expression.

I put list in to {dateState} set and (max({dateState}data.date)) returns correct result

but expression returns nothing:

Sum( TOTAL

    if(

        data.date <= (max({dateState}data.date)),

        data.Value,

        0

    )

any way thanks for the answer.

Not applicable
Author

I added variable selectedDateString '=(max({dateState}data.date))'

and the expressions:

Sum( TOTAL

    if(

        data.date <= selectedDateString,

        data.Value,

        0

    )

do work