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

Re: Expression to get the string from group of possible values


Hi, Thanks for the helpful answers.

Instead of concatenating the attr values, we want to display the attr value of the maximum date..

in the given example,

Input

ID, attr, Date          , value

1,  a   , 03/03/2014, 10

1,  b,  , 04/03/2014,  20

Output

ID, attr, Date1, Date2, Variance

1,   b,    10     ,20     , 10

can someone please provide me the expression to do so?

Thanks

10 Replies
MK_QSL
MVP
MVP

Can you share some more data?

Not applicable
Author

Hi

You want to do this at script level or Front end chart Exp?

Not applicable
Author

@@@
Hi Manish,

Thanks for the quick response.

The deatils are on the following thread

http://community.qlik.com/thread/109427

and I want to do this at the chart level..

In the attatched Report, for ID 1, as the attr value is different from Date1 to Date2, it displays them as 2 rows.

but, I want to display just one value which is maximum(Choosen dates)'s Value.

Thank You

MK_QSL
MVP
MVP

Like this?

Not applicable
Author

No,...I have date displayed in 2 filters as showed in the attached qvw.

I want the expression something similar to the following..

If( Date1>Date2, maxstring('$<Date = {'$(=GetFieldselections(Date1))'}>}Attr), MaxString({$<Date = {'$(=GetDFieldSelections(Date2))'}>}Attr))


Thanks

jerem1234
Specialist II
Specialist II

Try this:

For a calculated dimension:

=aggr(If( GetFieldselections(Date1)>GetFieldSelections(Date2), maxstring({$<Date = {'$(=GetFieldselections(Date1))'}>}Attr), MaxString({$<Date = {'$(=GetFieldSelections(Date2))'}>}Attr)), ID)

For an expression:

=if( GetFieldselections(Date1)>GetFieldSelections(Date2), maxstring({$<Date = {'$(=GetFieldselections(Date1))'}>}Attr), MaxString({$<Date = {'$(=GetFieldSelections(Date2))'}>}Attr))

If you don't plan on having the person select more than one Date2 or more than one Date1, this will do it. You were close, just had to make some adjustments. See attached.

Hope this helps!

Not applicable
Author

Awesome!.. That works perfectly..

Thank you so much!!

Not applicable
Author

Thanks a lot for the expression . it works perfectly fine.

But, I have 15 such attributes and having 15 calculated dimensions on the report, the performance drastically goes down...
is there any other alternative to calculated dimensions?

Thanking you in advance

jerem1234
Specialist II
Specialist II

Here try this formula instead, this should improve the performance a bit:

aggr(maxstring({$<Date = {'$(=rangemax(GetFieldselections(Date1), GetFieldSelections(Date2)))'}>}Attr), ID)

If you can, instead of calculated dimensions, I would use it as an expression instead, that way you can remove the aggr and just use:

maxstring({$<Date = {'$(=rangemax(GetFieldselections(Date1), GetFieldSelections(Date2)))'}>}Attr)

See if this helps at all.