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

returning multiple values using Only() function

Hello everyone,

I have a chart where I'm using set analysis with an alternate state to return values based on 'metric labels'. 

My issue is coming from when a user has multiple values in for one metric and I need to show both.

My current expressions looks like this:

only({<[Metric Label]={'Metric1'}>}Detail_Field)

only({<[Metric Label]={'Metric2'}>}Detail_Field)

only({<[Metric Label]={'Metric3'}>}Detail_Field)


To illustrate:

I'm currently using the Only() function to return the values per metric per user.  When there are 2 values for a metric, it returns a null value:

User IDMetric1Metric2Metric3
001-Metric2DetailMetric3Detail

When I remove the only() function, this is what I get:

User IDMetric1Metric2Metric3
001-Metric2DetailMetric3Detail
001Metric1Detail1-
001Metric1Detail2-

So you can see, I have 2 details in Metric 1, but since Qlikview doesn't know what value to use under the Only() function, it returns a null value.

What I'm trying to get is a single row per user.  If there are 2 details within a metric, I want them to all be within the same cell.

User IDMetric1Metric2Metric3
001

Metric1Detail1

Metric1Detail2

Metric2DetailMetric3Detail

Is this 3rd table achievable?

Thank you in advance

1 Reply
RSvebeck
Specialist
Specialist

try this:


concat({DISTINCT <[Metric Label]={'Metric1'}>}Detail_Field,CHR(13))



Svebeck Consulting AB