Qlik Community

QlikView Documents

Documents for QlikView related information.

grouping dimension values

grouping dimension values

Hi community,

to enable users to group dimension values into newly defined groups in order to perform analytics on this groups, I created this test application.

hope it might be of any use

regards

Marco

Suppose there is a "number" field which we want to group into different categories.

We add an input box bound to the variable vGroupName,

a Listbox "groupName" to select the different groups of numbers,

a table that shows what numbers belong to which group,

two charts that visualize the numbers and sums of the numbers by group

and a magic "new group of numbers" button that calls this vbs macro:

sub MakeGroup

  ActiveDocument.DynamicUpdateCommand("DELETE FROM tabGroups WHERE groupName = '$(vGroupName)'")

  for i = 1 to ActiveDocument.Evaluate("=getSelectedCount(number)")

  InsertValue = ActiveDocument.Evaluate("=subfield(getFieldSelections(number, ';'), ';' ,"&i&")")

  ActiveDocument.DynamicUpdateCommand("INSERT INTO tabGroups (groupName, number) VALUES ($(vGroupName), "&InsertValue&")")

  next

end sub

This macro populates the tabGroups table with a group name and the selected numbers.

We initiate the application using e.g. this script:

tabNumbers:

LOAD

  RowNo() as number

AutoGenerate 10;

tabGroups:

LOAD

  'one' as groupName,

  1 as number

AutoGenerate 1;

The result would look like this:

QlikCommunity_Thread_110794_Pic6.JPG.jpg

QlikCommunity_Thread_110794_Pic2.JPG.jpg

You then could select some numbers, enter a group name in the input box and press the "new group of numbers" button, which creates a new group consisting of your selected numbers and named as you entered in the input box.

QlikCommunity_Thread_110794_Pic3.JPG.jpg

QlikCommunity_Thread_110794_Pic4.JPG.jpg

QlikCommunity_Thread_110794_Pic7.JPG.jpg

This solution only works, if you can enable the dynamic update feature

QlikCommunity_Thread_110794_Pic5.JPG.jpg

on document as well as on server level and might be limited to the IE plugin due to the AJAX/macro issue.

Tags (1)
Attachments
Comments
kavita25
Valued Contributor

Its Superb...Custom Grouping...

But is it possible without Macro..as groups will be created by users in Access Point..so it would be better, if there's any solution other then Macro...

Version history
Revision #:
1 of 1
Last update:
‎03-17-2014 05:43 PM
Updated by: