Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
We value your feedback – take our 5-minute QlikView modernization survey
cancel
Showing results for 
Search instead for 
Did you mean: 
chitemerere
Specialist
Specialist

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
chitemerere
Specialist
Specialist
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

chitemerere
Specialist
Specialist
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

utkarshgarg
Creator II
Creator II

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

chitemerere
Specialist
Specialist
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


chitemerere
Specialist
Specialist
Author

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

Most appreciated

utkarshgarg
Creator II
Creator II

Happy to write a helpful answer.
Cheers