Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
uacg0009
Partner - Specialist
Partner - Specialist

2 dimensions with valuelist issue

Hi All,

I have some questions about valuelist() when I use it into a chart, I have data like :

Valuelist1.PNG

The result that I want should be like :

Valuelist2.PNG

And I have a idea to use valuelist to solve the problem, but when I create a table and the first dimension is

=ValueList('DFD','DFM')

second dimension is :

=if(ValueList('DFD','DFM')='DimDFD',DFD,DFM)

expression is :

=sum(Count)

it shows wrong, the second dimension can't recognize the valuelist I think,

do you know why or have any other ideas to solve this problem?

Thanks and you can tell me if you have any questions about the example, and you can use the attached.

1 Solution

Accepted Solutions
robert_mika
Master III
Master III

t1:

LOAD * INLINE [

    DFD, DFM, Count

    10%, 15%, 1

    10%, 25%, 1

    20%, 25%, 1

    , 35%, 1

    , 45%, 1

    30%, , 1

    40%, , 1

    , 45%, 1

    , 55%, 1

    50%, , 1

];

DFD:

load

'DFD' as LevelName,

DFD as Value,

sum(Count) as C

Resident t1

Where len(DFD)>0

Group by DFD

;

concatenate

DFM:

load

'DFM' as LevelName,

DFM as Value,

sum(Count) as C

Resident t1

Where len(DFM)>0

Group by DFM;

drop table t1

Capture.JPG

View solution in original post

4 Replies
robert_mika
Master III
Master III

t1:

LOAD * INLINE [

    DFD, DFM, Count

    10%, 15%, 1

    10%, 25%, 1

    20%, 25%, 1

    , 35%, 1

    , 45%, 1

    30%, , 1

    40%, , 1

    , 45%, 1

    , 55%, 1

    50%, , 1

];

DFD:

load

'DFD' as LevelName,

DFD as Value,

sum(Count) as C

Resident t1

Where len(DFD)>0

Group by DFD

;

concatenate

DFM:

load

'DFM' as LevelName,

DFM as Value,

sum(Count) as C

Resident t1

Where len(DFM)>0

Group by DFM;

drop table t1

Capture.JPG

uacg0009
Partner - Specialist
Partner - Specialist
Author

Hi Mika,

Thanks for your reply. Your method is great and I will try that.

So do you have any ideas that we can do the table not changing the script?

robert_mika
Master III
Master III

You will not be able to do that.

Your second dimension does not really make sense

=if(ValueList('DFD','DFM')='DimDFD',DFD,DFM)

how

ValueList('DFD','DFM')='DimDFD'

  ??

You can not mix synthetic dimension with standard dimension in the way you think.

BTW:

Calcification at script level are always faster.

Refer to this article to clear some fog

Missing Manual - ValueLoop() & ValueList()


uacg0009
Partner - Specialist
Partner - Specialist
Author

OK, thanks!