Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
patrickbender
Contributor III
Contributor III

Use selection as parameter in expression

Hi,

I have selected a date from a multibox and would like to use set analysis with the whole set (1) in order to sum a field that is

SUM({1<datefield={Highest value less than date selection}>}Sumfield)

Is that possible?

1 Solution

Accepted Solutions
sunny_talwar

Missed a parenthesis

Sum({1<datefield = {"$(=Date(Max({<datefield = {[$(='<' & Date(Min(datefield)))]}>} datefield)))"}>} Sumfield)

View solution in original post

7 Replies
vishsaggi
Champion III
Champion III

May be this?

= SUM({<datefield= { [$(=GetFieldSelections(YourfieldselectionFieldname))] } >}Sumfield)

patrickbender
Contributor III
Contributor III
Author

Almost there

It also needs to be latest date less than the selection.

sunny_talwar

May be using nested set analysis

Sum({1<datefield = {"$(=Date(Max({<datefield = {[$(='<' & Date(Min(datefield))]}>}datefield)))"}>} Sumfield)

sunny_talwar

Missed a parenthesis

Sum({1<datefield = {"$(=Date(Max({<datefield = {[$(='<' & Date(Min(datefield)))]}>} datefield)))"}>} Sumfield)

vishsaggi
Champion III
Champion III

My bad completely misunderstood the question. Try sunny's expression and let us know. 🙂

petter
Partner - Champion III
Partner - Champion III

A search string within a set expression will do:

     Sum( {<Date={'$(=Max({<Date={"<$(=Date)"}>} Date))'}>} Sales)

Replace Date with datefield and Sales with Sumfield above ...

patrickbender
Contributor III
Contributor III
Author

Thank you!