I have an app with data coming from three tables - A, B, C. They are used to calculate various KPIs. Each table has its own date field and all three are linked to another table showing group names. The data model looks like this:
The requirement is to show the KPIs per group. To do this I created a pivot table but since tables A, B, and C are now linked through the Groups table, all values in the pivot table update after I select a date field. I tried to fix this with set analysis, but it does not seem to work. Below an example.
This is my initial situation with the KPIs, the corresponding date fields, and the pivot table which I would like to have:
I want the values in the first column to be updated only when I select a month in A_RequestDate. However, this does not work, even though it is a requirement in the set analysis:
The same rules should also apply to the rest of the columns, i.e. B_OrderDate should not change columns 1 and 3, etc.
I also attach a QVF with sample data. Hope anybody could help!
Hi Steve, this is my first try using Qlik Sense ... and at once the first Qlik Sense feature (or bug ?!?) I found...
First, you're using the wrong datefields , for example[A_RequestDate]is not the same field as used in your listbox...
(is it called listbox in Sense?!?, I just call it listbox)
Your listbox uses[A_RequestDate.autoCalendar.YearMonth]
OK, I thought no problem just use [A_RequestDate.autoCalendar.YearMonth] instead of[A_RequestDate] within your set expression.
Surprisingly using auto calendar fields within set analysis or functions like getselectedcount() doesn't work for me at all. (using QlikSense Desktop 3.1 SR6, same problem with 3.2 SR2) . A short time I believed that I didn't understand anything at all about set analysis
Finally I had to create separate YearMonth Fields like that:
MonthName(Date(A_RequestDate ,'DD/MM/YYYY')) as A.YEARMONTH,
using that manually created fields works:
With the help of aggr() you could even set your listbox selections independent of each other...
Does anybody know why auto calendar fields don't work within expression at all?!? --> Bug or feature?!?
Hello Robin! Thank you very much for your response and effort!
I also first tried using the auto calendar fields in the set analysis but it didn't work. Unfortunately, your solution would not be optimal for me. The example I provided is a simplified version of a bigger data model that includes other tables/fields as well.
1) I would prefer not to change this model. In your qvf file the tables are concatenated into one big table.
2) It is really important that all date fields can be used simultaneously. Some of the KPIs are calculated on a monthly basis, others on a quarterly. For example, I need to select Jan in [A_RequestDate], but Jan, Feb, Mar in [B_OrderDate] and then something else [C_OrderDate]. The pivot table should reflect all this selections accordingly.
3) As some of the KPIs use the date fields in the calculation, I think that it would be best if the selection filters are linked to the calendar (and not created separately as YearMonth in the script)
I hope that this problem has a solution and there is no bug in QS.
Hi Robin and thanks for your comment! I do not think that this functionality is available in QS by default. Maybe with some extensions, but this is unfortunately not an option in our company as we had some bad experience in the past with extensions that stopped working after QS update.
If anybody could suggest something or explain why the set analysis is not working it would be great! Thank you!