Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
linoyel
Specialist
Specialist

'Latest in period' filter

Hi, I have cases with different versions in my data and I have an indication for the latest version for each case. I'm required to develop a DYNAMIC indication for the latest version for each case which would take users selections in consideration in order to determine the latest version for each case.

For example, case abc has 3 versions:  version 1 was received in June, version 2 - in July and version 3 - in October. The static filter for latest version will filter out only the third version. The dynamic filter is supposed to show the last version according to selections, so if a user choses June, July and August - then version 2 is supposed to be filtered out as a highest version according to selections.

Is there a way to create this kind of indication (filter) in UI? The best would be to create such an indication as a filter ('Latest In Period' with the value 'Yes') to filter out the whole app and not to create object-wise indications. 

Thanks 🙂

Labels (2)
4 Replies
ArnadoSandoval
Specialist II
Specialist II

Hi @linoyel 

If  I understood your definition, you have a list of Received_Date-Version data, and you want to show the versions according to the selected Received_Date; I wrote a very small sample application, attached with a solution.

Its Load Script is:

Versions:
Load * Inline [
Received_Date, Version
01/06/2020, Version 1
01/07/2020, Version 2
01/10/2020, Version 3
];

This is its UI

Received_Data_01.png

There are two ways to implement its solution, both with KPI objects, as shown above; the top one is using a variable, named Selections with the following expression:

=concat( distinct chr(39) & Received_Date ,chr(39) &',') & chr(39)

The second KPI object implement the Concat code, directly in the KPI expression, which is fine, a little bit longer and more cryptic as using the variable:

The expression in the second KPI object is like this:

MaxString({<Received_Date={ $(=concat( distinct chr(39) & Received_Date ,chr(39) &',') & chr(39))}>} Version)

My personal preference is with the Variable, the code is easier to read instead of typing the whole thing directly in the KPI expression; It is up to you which one to use.

Hope this helps.

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
linoyel
Specialist
Specialist
Author

Hi @ArnadoSandoval , thanks for your solution. You implement the approach of showing the relevant version in a specific object (KPI). What I'm looking for is to mark the cases population with 'last in period' version flag for every case and then the whole app with all its objects is supposed to take in consideration only these rows. 

I've added the IsLastVersion field which is a static field that indicates the last version for each case.

I need to develop similar field that would mark the relevant rows by some flag (like '1' or 'Yes') but it's supposed to be influenced by user selections. This new field is also supposed to be used as filter - exactly like the static IsLastVersion filter. Please see the sample app attached, I've added some code there. If you make the choices I made in the below print screen, The LastVersion KPI = 1 case - cause according to the choices we have only 1 case with the latest version in the data: case b version 2. I need another KPI that will count the cases with their latest versions according to selections - case a's latest version is 4 BUT according to the selections its last version is 2, that's why it's also supposed to be counted. 

linoyel_0-1609837239543.png

 

 

 

ArnadoSandoval
Specialist II
Specialist II

Hi @linoyel 

I separated the Received_Date field, into its own, independent dimension with the name Received_Date_Selector, so its selection does not affect the table; I modified the Selections variable to reference the new field instead, I also modified the Received Date selector to use the new field; I also added a variable MaxSelection telling us what is the current version based on the selected Received_Date.

All these changes in the attached QVF file, here a couple of screenshots:

Max_Selections_01.pngMax_Selections_02.png

Hope this helps,

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
linoyel
Specialist
Specialist
Author

Hi @ArnadoSandoval ,

Thanks for your solution. You've described a nice way to present the latest case version per user's selections in the date field. Though the requirement was a bit different - to create the 'Last version by selections' calculated flag field which is supposed to behave the same way as the regular 'Last version' flag: when a user filters it out pressing on 'yes', then behind the scenes it's supposed to take into account the relevant case-version population, and then every object in the app is supposed to reflect that population - if it's KPI or bar chart or a table or whatever. I guess the mission is kind of impossible here... just tried to get some ideas. I guess I'll have to adjust the requirements to something more specific - as in your example showing the last case version per user selections in a date field in a straight table. Thanks! I'll update if something interesting will pop up on this 🙂