Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AVG and SUM functions reside on the same expression?

Hi,

I have set of KPI definition that should be evaluated "on the fly" using dollar expansion and presented in straight table

SOURCE

KPI:

LOAD INLINE * [

[KPI ID], [KPI Definition]

1, 'AVG([KPI Value])'

2, 'AVG([KPI Value])'

3, 'SUM([KPI Value])'

]

;

KPIValue:

LOAD [KPI ID]

         ,[KPI Value]

RESIDENT KPI_Value;

Straight table:

Dimension:

- KPI ID

Expression:

$(=[KPI Definition])

Problem: calculation of the expression fails when it try to calculated KPI 3.

Any idea's how i can solve this?

Thanks in advance!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Use

pick(

KPIID,

$(=concat({1} KPIDefinition,','))

)

to make the concat indepent from selections.

edit: see also http://community.qlik.com/thread/59081

View solution in original post

6 Replies
Not applicable
Author

check this app...

chematos
Specialist II
Specialist II

try this:

aggr($(=[KPI Definition]), [KPI ID])

swuehl
MVP
MVP

I think the only way to create a dynamic expression is to use a pick() / match () combination:

=pick(

KPIID,

$(=concat(KPIDefinition,','))

)

See also attached,

Stefan

Not applicable
Author

This works. but... If you select KPI 3, you'll end up with null. KPI 1 & 2 work fine Knipsel.PNG

swuehl
MVP
MVP

Use

pick(

KPIID,

$(=concat({1} KPIDefinition,','))

)

to make the concat indepent from selections.

edit: see also http://community.qlik.com/thread/59081

Not applicable
Author

Thanks, guys.

The pick method worked like a charm. THANKS!