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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
spividori
Specialist
Specialist

Difference in percentage per year

Hi.

In the example, I have a bar chart which calculates the difference in percentage of Qty per year. I need that the chart does not show the years who did not have Qty.

Regards.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try this as script

Data:

LOAD  Año, if(isnum(QtyF),QtyF) as QtyF, QtyM;

LOAD * INLINE [

    Año, QtyF, QtyM

    2005, , 3

    2005, , 2

    2006, , 6

    2007, 4, 4

    2007, 8, 2

    2008, 9, 5

    2009, 2, 1

    2010, 3, 5

    2011, 5, 3

    2012, 5, 5

    2012, 4, 6

    2013, 1, 7

];

sum({<QtyF={'*'}>}) for the QtyF expression and (above( [QtyF])-[QtyF]) / above([QtyF]) for the Dif% expression


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try this as script

Data:

LOAD  Año, if(isnum(QtyF),QtyF) as QtyF, QtyM;

LOAD * INLINE [

    Año, QtyF, QtyM

    2005, , 3

    2005, , 2

    2006, , 6

    2007, 4, 4

    2007, 8, 2

    2008, 9, 5

    2009, 2, 1

    2010, 3, 5

    2011, 5, 3

    2012, 5, 5

    2012, 4, 6

    2013, 1, 7

];

sum({<QtyF={'*'}>}) for the QtyF expression and (above( [QtyF])-[QtyF]) / above([QtyF]) for the Dif% expression


talk is cheap, supply exceeds demand
spividori
Specialist
Specialist
Author

Hi Gysbert.

Thanks for responding.

It does not work, keep looking the years without QtyF.

Any idea?. Thank you.

Regards.

spividori
Specialist
Specialist
Author

Hi.

I'm trying to solve with setanalysis does not work.

I use the followingexpression: sum ({$ <Año={"=Año-1"}>} QtyF) but bringsthesumof the relevant yearand not the previous so I can calculate the percentage of difference.

Capture.PNG

Regards.

spividori
Specialist
Specialist
Author

This works fine. Thank you very much.

Could you explain the meaning of the expression:

Sum ({<QtyF={'*'}>} QtyF)

especially how it works: {'*'}

Regards.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

The {'*'} means all values. Nulls are not values so the years where QtyF doesn't have a value are excluded from the expression calculation and because of that also from the chart.


talk is cheap, supply exceeds demand