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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis with parameter

I have this expression in a pivot chart:

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

I want to show how much the article have sold before it was released. However, when i select one article the expression works. But when i dont have anything selected it does not, instead it shows the total sales for each product.

Any tips?

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

The reason this only works when something is selected is that without a selection, which article should the expression use? Remember set analysis executes outside the context of a chart/table and has no knowledge of the dimensions. If you are using this inside a table and want the date subject to the article (and the article is a dimensionm or unique within a dimension), then the only approach is to use sum(If())

  • Sum(If(Date=<Date(ArticleReleaseDate) Sales))

SumIf does perform poorly compared to set analysis, and if that approach takes too long to compute, you might want to add a flag in the load script to indicate sales with dates less than the release date. Then you can use something like:

  • Sum({<ReleaseFlag={1}>} Sales)

Hope that helps

Jonathan

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

View solution in original post

8 Replies
MayilVahanan

Hi

     Try like this,

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

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Have you got an example to try on ?

Jonathan

Not applicable
Author

Same problem im afraid. Thanks anyway

Not applicable
Author

No I havnt, the application is to big.

Not applicable
Author

Hi,

Add the max() function to expression:

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

Regards,

Ricardo

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

The reason this only works when something is selected is that without a selection, which article should the expression use? Remember set analysis executes outside the context of a chart/table and has no knowledge of the dimensions. If you are using this inside a table and want the date subject to the article (and the article is a dimensionm or unique within a dimension), then the only approach is to use sum(If())

  • Sum(If(Date=<Date(ArticleReleaseDate) Sales))

SumIf does perform poorly compared to set analysis, and if that approach takes too long to compute, you might want to add a flag in the load script to indicate sales with dates less than the release date. Then you can use something like:

  • Sum({<ReleaseFlag={1}>} Sales)

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

The load script could look something like:

Join (Sales)

LOAD ArticleNr,

     ArticleReleaseDate

Resident Articles;

Join (Sales)

LOAD Date,

     ArticleNr,

     If(Date < ArticleReleaseDate, 1, 0) As ReleaseFlag

Resident Sales;

DROP Field ArticleReleaseDate From Sales;

Adjust the script accordingly for your object names. I am assuming that you have a ArticleNr exists in both tables.

Regards

Jonathan

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

Thanks Jonathan. I will try this.