Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
TimmyCNHi
Creator
Creator

Custom Classification Filter

Good day everyone 🙂

I have some kind of 'Savings overview' dashboard that allows people to filter all sorts of criteria. One of the Columns in the dashboard table has the following calculation:

=sum(if(CostOrSaving='S',
[Amount]))
-sum(if(CostOrSaving='C',
[Amount]))

In the Data manager I have created a Calculated field called Classes that does the following calculation:

If(Amount>=1000,'A',
If(Amount>=800,'B',
If(Amount>=500,'C',
If(Amount<500,'D'))))

This is pretty much how my source data looks like:

ProjectDateCostOrSavingAmountClasses
Donkey14/01/2020C1500A
Donkey29/01/2020S700C
Donkey07/02/2020S800B
Donkey18/02/2020S1000A
Giraffe25/02/2020C800B
Giraffe14/03/2020S1700A

 

When no filters are applied, the table in my dashboard shows something like:

ProjectTotal Saving
Donkey1000
Giraffe900

 

But when I apply 'A' in the Classes filter, it shows something like this:

ProjectTotal Saving
Donkey-500
Giraffe1700

 

So it's basically performing the filter first, then does the calculation in the table while it should work the other way around. This is the goal:

ProjectTotal Saving
Donkey1000

 

How do I achieve this? I'm using Qlik Sense Desktop April 2020 Patch 1.

 

Cheers

Timmy

Labels (2)
6 Replies
sunny_talwar

I am not sure how you came up with the expected output? Can you share why would you see only Donkey and with 1000? Also, currently it is only showing Giraffe? It doesn't show Donkey with -500 when A is selected?

TimmyCNHi
Creator
Creator
Author

I'm sorry, you're right. I simplified the example a great deal compared to my real data so I expected it wouldn't show the -500 but I've now created a new app with just the example data used here and the -500 does show. The original post has been edited. 

sunny_talwar

I guess if you have selected A, why are expecting to see 1000 for Donkey? Regardless of the order of operation, if A is selected there are only tow rows for Donkey which has A. I think you might need to elaborate a little more as to how you end up with the expected output

TimmyCNHi
Creator
Creator
Author

Thank you for your feedback, @sunny_talwar. Good point! The logic I'm trying to achieve is that project 'Donkey' has a cost of 1500 and a combined saving of 2500, resulting in a total saving of 1000. So it should first perform the calculation (as it currently already does in the table) but then afterwards assign the 'A' classification. I understand this logic may be somewhat paradoxical and therefore impossible (?) but maybe there is a way to attack this. Perhaps I shouldn't classify the values in the data manager but rather add a measure column in the sheet's table.

Edit: adding this to the table was easy as Qlik allowed me to refer to the 'Saving' column but I can't seem to be able to refer to the 'ProjectClass' column from the filter.

image.png

sunny_talwar

But Giraffe was associated with class A once too.. why did we remove Giraffe and only kept Donkey?

TimmyCNHi
Creator
Creator
Author

Good morning!

Ah but in project Giraffe there's a cost of 800 and a saving of 1700, meaning its total saving dunks below the required 1000 to attain the 'A' status. At 900 it should be appointed the B status (800-999).

Giraffe25/02/2020C800B
Giraffe14/03/2020S1700A

 

I believe I'm on the right track with appointing the class in the table, I just need to be able to filter that column with a filter pane.

ProjectSavingProjectClass
Donkey1000A
Giraffe900B