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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_puccetti
Partner - Creator
Partner - Creator

Set Analysis

Hello i need to know if is anything wrong in this expression, it doesn't return me the expected values:

Count({<[FIELD A]={"=$([FIELD A])-1"}}DISTINCT [FIELD B])

Thanks

Marco

21 Replies
maxgro
MVP
MVP

I think this only works when you select 1 value in FIELD A

=Count({<[FIELD A]={"$(=([FIELD A])-1)"}>}DISTINCT [FIELD B])

maybe

=Count({<[FIELD A]={"$(=max([FIELD A])-1)"}>}DISTINCT [FIELD B])

but it's still not clear what do you want to achieve

Peter_Cammaert
Partner - Champion III
Partner - Champion III

The reason that this doesn't work is that set analysis is evaluated outside of a chart to reduce/expand the data rows that go into the chart. This evaluation happens before any calculation is performed.

The logical consequence, as Massimo already pointed out, is that -1 will return all currently selected values in field and then try to subtract 1 from that result. Which only works if you select a single value in .

Set analysis does not work row-by-row, but globally for all data used in a chart.

Peter

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Oh and by the way: for a single value you better use something like ...{'$(=-1)'}

marco_puccetti
Partner - Creator
Partner - Creator
Author

I have also tried with this

Count(DISTINCT {<={"=$(-1)"}>})

but doesn't work.

Thanks

Marco

Digvijay_Singh

But this is different than what pcammaert has suggested, try single quote as suggested. But restrict selection of single value only in list box.

marco_puccetti
Partner - Creator
Partner - Creator
Author

I have tried but it is still not working.

Any other ideas?

Thanks

Marco

marco_puccetti
Partner - Creator
Partner - Creator
Author

I have tried with this statement using the above but it still not working:

=Count(DISTINCT {< = {"=$(above())"}>})

Where A is a dimension of the table and B is an expression.

The above works fine but if used within the expression doesn't work.

Thanks

Marco

marco_puccetti
Partner - Creator
Partner - Creator
Author

Hello, anybody knows what's wrong about this formula?

=Count({< [year = {"=$(=Num(above([year]),'0'))"}>}distinct [object])

I need to count the sum of object of a previous year.

For me this is correct infact the Num(above([year]),'0') works, but not if inserted in the Count expression.

Thanks

Marco

maxgro
MVP
MVP

I think there are some syntax error, this should be ok from a syntax point of view

=count( {$ <year={"$(=above(year))"}>} distinct object)

but I'm not sure above and set analysis together make sense (above is an inter record function, set analysis is calculated once for chart)

what do you want to achieve?

count distinct object when the year is ....???

marco_puccetti
Partner - Creator
Partner - Creator
Author

I need to get the sum comparison between one year row and the above, that could not be sequentially.

Used singularly the above works perfectly, but not in the expression.

Is it possible to write a formula in order to get a value like this?

Thanks

Marco