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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Trending with Line Chart

I am trying to trend a growth rate fact with a time dimension, MonthYear.  The growth rate is calculated as:

[current month prescriptions]/[previous month prescription] - 1 and formatted as a percentage.  To test the calculation, i have created a text object which yields the following value:

Screen Shot 2014-12-14 at 10.09.47.png

However when i try to trend the growth rate in a line chart over the MonthYear dimension, only one point is displayed as follows:

Screen Shot 2014-12-14 at 10.09.34.png

The value displayed is for only one point which is the last MonthYear equivalent.  Can you assist in resolving this problem.

Regards

Chris

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Managed to figure is out with the following expression for the growth rate:

=count(DISTINCT [Script Number])/Above(Count(DISTINCT [Script Number]))-1

with the following result:

Screen Shot 2014-12-14 at 12.24.02.png

Thank you all

Regards.

Chris


View solution in original post

6 Replies
rajeshvaswani77
Specialist III
Specialist III

Hi,

Could you please post an example QlikView file?

thanks,

Rajesh Vaswani

Anonymous
Not applicable
Author

Many thanks Rajesh

I have seen where the problem is.  My expression for calculating 'Previous Month' has errors.  I tested it out by constructing the following straight table:

Screen Shot 2014-12-14 at 11.57.57.png

The expression for 'Current Month' is:

=Count(Distinct [Script Number])

I tried the following for previous month which is yielding the above result:

=Count(${<Month = $(=max(Month)-1)>}Distinct[Script Number])

Can you assist?

Regards

Chris

Anonymous
Not applicable
Author

Use this :

=sum(prescriptions)/above(sum(prescriptions))-1 in the chart and you will get what you need. And of course check the percentage box

Cheers

Anonymous
Not applicable
Author

Managed to figure is out with the following expression for the growth rate:

=count(DISTINCT [Script Number])/Above(Count(DISTINCT [Script Number]))-1

with the following result:

Screen Shot 2014-12-14 at 12.24.02.png

Thank you all

Regards.

Chris


Anonymous
Not applicable
Author

Many thanks Utkarsh, that is the right approach, i had managed to figure it out when i got your response.

Most appreciated

Anonymous
Not applicable
Author

Happy to write a helpful answer.
Cheers