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

Combining dimensions into one in chart

I have the following data table:

IDTargetCurrent
3245613
975452
321564
751227
325445

'Target' and 'Current' share the same values.

How can I create a chart like this, where I have COUNT(ID) as the expression, and the two dimensions as one?

cHART.PNG

18 Replies
qliksus
Specialist II
Specialist II

May be something like this

Load ID,

Target,

Current ,

Subfield(Key,'-') as Dim ;

Load

ID,

Target,

Current ,

Target&'-'&Current as Key

from table ;

Now use this dim in the chart for your calculation

jessica_webb
Creator III
Creator III
Author

Thanks for the response. Would there be anyway to do this directly in the chart?

I'm having real troubles getting a new dimension into the script:

Re: Reload data with renamed fields

qliksus
Specialist II
Specialist II

Maybe something like this

Dimension: ValueList($(=Concat(DISTINCT Current ,',')&','&Concat(DISTINCT Target ,',')))

Expression : count(distinct if(Current=ValueList($(=Concat(DISTINCT Current ,',')&','&Concat(DISTINCT Target ,','))), ID)) +

count(distinct if(Target=ValueList($(=Concat(DISTINCT Current ,',')&','&Concat(DISTINCT Target ,','))), ID))

rahulpawarb
Specialist III
Specialist III

Hello Jessica,

May be try below calculated dimension:

=Pick(Match($Field,'Target','Current'),[Target],[Current])

Regards!

Rahul Pawar

jessica_webb
Creator III
Creator III
Author

Thanks Rahul, but I still want to keep the 'Target' and 'Current' dimensions showing separately in the chart.

In your example, they are grouped together into one bar.

jessica_webb
Creator III
Creator III
Author

This looks as though it is grouping the two dimensions into one... I would like them to still show side by side.

Not applicable

Hi

can you explain what the dimension and expressions are, that will help in finding what you need and to give solution.

Kushal_Chawda

like this

Data:

LOAD ID,

    Target as Value,

    'Target' as Flag

FROM

[https://community.qlik.com/thread/268478?sr=stream&ru=186120]

(html, codepage is 1252, embedded labels, table is @1);

Concatenate

LOAD ID,

    Current as Value,

    'Current' as Flag

FROM

[https://community.qlik.com/thread/268478?sr=stream&ru=186120]

(html, codepage is 1252, embedded labels, table is @1);   


Create Bar chart


Dimension:

Value

Flag


Expression:

Count (ID)


Capture.JPG

jessica_webb
Creator III
Creator III
Author

Hi Krishna,

The dimensions are in the table here (so ID, Target, Current)

IDTargetCurrent
3245613
975452
321564
751227
325445

The expression is Count(ID)

So the table/Chart outcome I would want is:

CountDimension 1Dimension 2
11Target
01Current
12Target
12Current
03Target
13Current
14Target
14Current
15Target
15Current
16Target
06Current
07Target
17Current