Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
adamdavi3s
Master
Master

AGGR and set analysis quandry

Hi All,

The attached qvw will explain the issue better than I can in words. Note my production qvw is a lot more complex, however this explains the crux of the issue

Basically I am tying to create an index value based on a number of columns, I can do this absolutely fine in a chart for the selected dimension.

set_quandry.JPG

The formula is:

((((SUM(ACTIVITY) / SUM(COST))/(SUM(TOTAL ACTIVITY) / SUM(TOTAL COST)))* SUM(ACTIVITY))/(SUM(TOTAL ACTIVITY) ))*100

What I then want to do, is show the same value in a chart for ALL dimensions, even though one of those dimensions is selected

However the index value is the sum of a calculation done at a line level so for company A index = 1503.90

This is what I want to end up with, but with the right values:

set_quandry2.JPG

My current formula is:

sum( {<COMPANY-= >}

    aggr(

        SUM({<COMPANY-= >}

            AGGR(

           

                        (

                            (

                                    (    /*weight*/

                                        (sum({<COMPANY-= >}COST)

                                        / sum({<COMPANY-= >}ACTIVITY)

                                        )

                                        /

                                        (sum(TOTAL {<COMPANY-= >}COST)

                                        / sum(TOTAL {<COMPANY-= >}ACTIVITY)

                                        )

                                    )

                                    *

                                    ( /*activity*/

                                     sum({<COMPANY-=>}ACTIVITY)

                                    )

                            )

                            /

                            /*total activity*/

                             sum(TOTAL {<COMPANY-= >}ACTIVITY)

                            

                        ) *100

                   

           

           

            ,CODE,COMPANY)

        ),COMPANY

    )

)

Now I am 99% sure this is going wrong due to the TOTALs, because it is using the totals for ALL dimensions, not PER dimension

But I am going in circles trying to figure it out!

Labels (1)
1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III


I think this might be the reformulated expression that could calculate what you want - I attached the modified QVW too:


2015-07-26 #1.PNG

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

Not sure I understand the expected out? What exactly are you trying to get?

petter
Partner - Champion III
Partner - Champion III


I think this might be the reformulated expression that could calculate what you want - I attached the modified QVW too:


2015-07-26 #1.PNG

adamdavi3s
Master
Master
Author

That looks good thank you, can you explain the syntax to me as I haven't come across the use of angle brackets like that before.

I'll put it in my production dashboard tomorrow and check it scales up with the complexity!

adamdavi3s
Master
Master
Author

actually no it does make sense now I read the syntax for total, thank you!