Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Set analysis behave strange.

Hi,

I am working with Set analysis to create some KPIs in a dashboard.

To understand it correctly I am still going with tests.

I have this KPI function:

Sum( aggr ( { $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} discoverydate))))'} >}

    price, product_id, filter_date) )

I have a current selection, with one product_id and one merchant, thus I should have one product with one price.

As I go with this set analysis I expect that the Sum of the one record should be the price of that product.

But if I have no filter_date selection in the current selection, I get a higher value.

Only if I set the filter_date by myself in the selection the Sum equals one price.

Is the Set analysis wrong?

1 Solution

Accepted Solutions
MVP
MVP

Re: Set analysis behave strange.

Not quite sure what your setting is, have a look at

Set Analysis in the Aggr function

So try with adding the set analysis to the outer aggregation, too:

Sum({ $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} discoverydate))))'} >}

aggr ( { $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} discoverydate))))'} >}

    price, product_id, filter_date) )

2 Replies
MVP
MVP

Re: Set analysis behave strange.

Not quite sure what your setting is, have a look at

Set Analysis in the Aggr function

So try with adding the set analysis to the outer aggregation, too:

Sum({ $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} discoverydate))))'} >}

aggr ( { $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} discoverydate))))'} >}

    price, product_id, filter_date) )

Not applicable

Re: Set analysis behave strange.

Ok, I tried with 2 Sets before, but there are more things to be right.

I thought because of the reduced data, that I don't need that much dimensions in the AGGR.

But if I leave out the filter_date as dimension, it doesn't find data. The matrix seemed to be calculated and then the data is cut out depending from the Set.

What I now have:

(Dunno why this editor puts it as table)

Sum( { $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} filter_date))))'}, calc_merchant= {"OWN_CLIENT_DATA_FLAG"} >}
aggr ( { $ <filter_date = {'$(=date(floor(Max( {$<[filter_date]=>} filter_date))))'}, calc_merchant= {"OWN_CLIENT_DATA_FLAG"} >}
   price * selling_quantity, product_id, calc_merchant, filter_date) )

I need cals_merchant as dimension because otherwise there are empty values for selling_quantity and thus even with the cals_merchant set to "OWN_CLIENT..." (where I have values for the selling_quantity) the AGGR is build in a wrong way.

I think I am near 80% to get it.

Thx for the help.