Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Compare values from different fields

Hi folks,

here's a challenge I'm currently facing: I got three Fields (Code A, Code B, Wert)  (Wert is German for value). The values in Code A und Code B a from the same co-domain, but from different sources (hence two fields). I need to compare the summed Wert for each distinct value from this co-domain depending on the source. The appended image serves as an example of what I'm planning to do.

Unbenannt.PNG.png

Is there any way to get this done efficiently in Qlikview? Any help would be appreciated! Thanks a lot in advance!

I added an example QV document for you to modify and experiment with if required.

Bests!

Tags (1)
7 Replies
MVP
MVP

Re: Compare values from different fields

You can do it in the script like

INPUT:

LOAD * INLINE [

    CodeA, CodeB, Wert

    1, 1, 10

    1, 2, 20

    2, 2, 30

    2, 2, 50

    3, 1, 80

];

LOAD CodeA as Code,

  sum(Wert) as WertA

Resident INPUT GROUP BY CodeA;

JOIN LOAD CodeB as Code,

  sum(Wert) as WertB

Resident INPUT GROUP BY CodeB;

Not applicable

Re: Re: Compare values from different fields

Thanks, a lot! This is the correct answer to the initial question. However, it seem like I forgot to add that there are various additional attributes associated with each row (like Year, see the updated, attached qvw).

Using your suggested solution will cause ignorance of selections being made. Right? Any way to circumvent this except for using additional attributes in the group by clause which isn't really efficient given the number of attributes I have got in my original application.

Not applicable

Re: Compare values from different fields

Hello,

If you want that at chart level, please find the attached document.

Thanks,

Angad

MVP
MVP

Re: Compare values from different fields

Not sure if I understand what you mean, selections in Year should be working.

What do you expect to see using your sample file?

rahulgupta
Contributor III

Re: Re: Re: Compare values from different fields

Hi Andreas,

Please find the attached application as per your requirement.

Hope this helps.

Warm Regards

Rahul

Not applicable

Re: Re: Compare values from different fields

Hi Angad!

Thanks for your solution! It is close but behaves unexpected whenever you select a certain value from Code A or Code B (see image, and try it in your solution).

Unbenannt2.PNG.png

I think the RangeMax swallows the 1 here, doesn't it?

Not applicable

Re: Re: Compare values from different fields

Hi Rahul,

yes, your solution will work, but only with the minimal example. Whenever you get another Field in the INPUT table, you would need to add it to the computed table and the GROUP BY statement, which is very inflexible.

Community Browser