Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sujeetsingh
Master III
Master III

Comparison of Data ??

Hello all,

Please find the attached sample and it to has details of the problem.

Thanks,

gwassenaarjagan

1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III
Author

I discovered a way in UI. The trick is to use aggr function on Year and use Above in next expression. Thanks all specially jagantresesco‌ . Thanks all.

View solution in original post

10 Replies
tresesco
MVP
MVP

Tab1:

Load *

INLINE [

    ID, Year, "Quarter Year", Sales

    1, 2011, Q1-2011, 1

    2, 2011, Q2-2011, 3

    3, 2011, Q3-2011, 4

    4, 2011, Q4-2011, 1

    5, 2012, Q1-2012, 5

    6, 2012, Q2-2012, 12

    7, 2012, Q3-2012, 13

    8, 2012, Q4-2012, 14

    9, 2013, Q1-2013, 21

    10, 2013, Q2-2013, 18

];

left Join

Load

  'Q'&Mid([Quarter Year],2,1)&'-'&(Num(Mid([Quarter Year],4,4))+1) as [Quarter Year],

  Sales as PrioSales

Resident Tab1;

Anonymous
Not applicable

There is no vaules in prioir of the 2011

sujeetsingh
Master III
Master III
Author

Tresco I need the total sum of Year to ploted against each quarter of the next year.

That is waht I calculated PreSales. I want to achive it at UI.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Dear Sujeet,

Its always better to move the calculations at the script level.

I would recommended that you should try same logic as the example tresesco‌ had given.

Regards,
Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
sujeetsingh
Master III
Master III
Author

I agree but a complex data models hinders all here.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Sujeet I agree too that it wont be as simple as it seems, but as a developer you should also think about end users performance.

Keeping heaving calculations like this, may kill your application when you will have huge data.

So try if you can accommodate the logic in script to reduce the performance.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
tresesco
MVP
MVP

That can be done using a synthetic dimension and expression in combination with Pick() and Match(). That would be complex and with some disadvantages.

jagan
Luminary Alumni
Luminary Alumni

Hi Sujeet,

It is difficult to handle this in Front end because we cannot control the axis, show data for one quarter in another quarter in chart. It should be handled in Script only.

If there is a fixed number of quarters to display in the chart then we can do this easily by using synthetic dimension since it has no relation to the expression

Hope this helps you.

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script

Tab1:

Load

ID,

Year,

[Quarter Year], Sales

INLINE [

    ID, Year, "Quarter Year", Sales

    1, 2011, Q1-2011, 1

    2, 2011, Q2-2011, 3

    3, 2011, Q3-2011, 4

    4, 2011, Q4-2011, 1

    5, 2012, Q1-2012, 5

    6, 2012, Q2-2012, 12

    7, 2012, Q3-2012, 13

    8, 2012, Q4-2012, 14

    9, 2013, Q1-2013, 21

    10, 2013, Q2-2013, 18

];

YearlySales:

Load

  (Year + 1) as Year,

  Sum(Sales) as PrioSales

Resident Tab1

WHERE Exists(Year, Year +1)

Group BY Year