Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted

MaxString is not working in advanced set analysis

Hi All,

I have below MaxString expression which is working fine for each line.

= Maxstring( {< %BILLINGDOC=, KONV.KSCHL={'ZVSH'} >} KONV.KNUMH) 

Now, I have to find max KNUMH value (for that I used above maxstring  function) and sum up the respective KBETR values for each MEL numbers. So, I am trying to apply the same in advance set analysis which is not working.

= Sum (  {<


KONV.KNUMH={"= Maxstring( {< %BILLINGDOC= ,KONV.KSCHL={'ZVSH'}>} KONV.KNUMH)" }

         >}


KONV.KBETR)


In my case it should show 0 i.e KBETR is 0 for for the KNUMH - 0322567585.


I think Maxstring function is not working in advanced set analysis. Any help or guidance is appreciated.

Capture.PNG

Note:  Please do not ask me to upload the application which is not possible,

Edit: I have uploaded sample document

Tags (1)
20 Replies
andrey_krylov
Valued Contributor

Re: MaxString is not working in advanced set analysis

Try this

= Sum (  {<


KONV.KNUMH={"$(= Maxstring( {< %BILLINGDOC= ,KONV.KSCHL={'ZVSH'}>} KONV.KNUMH))" }

         >}

Re: MaxString is not working in advanced set analysis

It will be evaluated only once per chart and keep one max value. I need to find max KNUMH value for each MEL numbers or each lines.

andrey_krylov
Valued Contributor

Re: MaxString is not working in advanced set analysis

As I know set analysis does work this way "once per chart" and not for each line.

MVP & Luminary
MVP & Luminary

Re: MaxString is not working in advanced set analysis

You could try it in this way:

= Sum (  {<


KONV.KBETR={"=KONV.KNUMH=Maxstring( {< %BILLINGDOC= ,KONV.KSCHL={'ZVSH'}>} KONV.KNUMH)" }

         >}


KONV.KBETR)

- Marcus

vishsaggi
Esteemed Contributor III

Re: MaxString is not working in advanced set analysis

Never tried this way but just give it a try:

= Sum ({< KONV.KNUMH = {"$(= FirstsortedValue(KONV.KNUMH, -Aggr(Maxstring( {< %BILLINGDOC= ,KONV.KSCHL={'ZVSH'}>} KONV.KNUMH), MEL)))"} >} KONV.KBETR)

Re: MaxString is not working in advanced set analysis

I have already tried yours before I posted this question but no luck. Sorry, I could have mentioned what I have tried earlier.

Re: MaxString is not working in advanced set analysis

Is this not evaluated once per chart?

Re: MaxString is not working in advanced set analysis

Shouldn't this be the expression

=FirstSortedValue({<%BILLINGDOC= ,KONV.KSCHL={'ZVSH'}>} Aggr(Sum({<%BILLINGDOC= ,KONV.KSCHL={'ZVSH'}>} KONV.KBETR), MARA_ENHANCED.NORMT, KONV.KNUMH), -Aggr(Rank(KONV.KNUMH), MARA_ENHANCED.NORMT, KONV.KNUMH))

Re: MaxString is not working in advanced set analysis

This works for your sample except for when MEL is 4... I see Cond = 5 to be max... isn't it?

=FirstSortedValue(DISTINCT Aggr(Sum(Sales), MEL, Cond), -Aggr(Cond, MEL, Cond))