Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
prachisangewar
Creator
Creator

Trend Report in Qlikview

Hi,

I have a Pivot table chart where users select Start Date and End Date and the Chart shows a trend for those days as shown below:

                   

Dim1   Dim2       31-JAN-16    1-FEB-16   ...................................29-FEB-16

1          a               10               21.................................................80

2          b               11               22..................................................90   

3          c               12               23...................................................100

4          d               13               24...................................................105

Start Date = 31-jan-16

End Date = 29-Feb-16

Now the requirement is the Enhance this chart to have another measure which is the difference between two consecutive days:

Eg for 1-Feb-16 , it is 1-Feb-16  -  31-Jan-16 i.e. from above example for row 1 it is 21-10 = 11 and so on for all the days.

Please help to suggest how this can be achieved(keeping the Start Date and End Date dynamic and Chart is Pivot Table )

Thank you !

10 Replies
Anonymous
Not applicable

Hi prachi,

You can do it in two ways:

1.- Sum(Value)-Before(Sum(Value),1)

2.- Load previous day value on script and on your expressión: Sum(Value)-Sum(ValuePrev)

Regards

prachisangewar
Creator
Creator
Author

Hi Manuel,

Thank you for the suggestion.

The chart also has Stddev based on the difference,but I am not able to use Before Or Above function with Stddev,

(Also I don't want to load the Previous value in the script as the report can be dynamic do go 2 days or 3 days ago value,so i prefer the before function).

Also,since my report is Trend the STDDEV for the Normal measure is :

Stdev(AGGR(((SUM(MEASURE)*1000000/RATE)),DATE,dim2))

Please suggest if any clue to do this with the Before/Above function for the Difference Measure

Thank you so much!

Anonymous
Not applicable

Hi Prachi,

This is on QlikView Help:

before([ total ] expression [ , offset [,n ]])

Returns the value of expression evaluated with a pivot table's dimension values as they appear in the column before the current column within a row segment in the pivot table. This function returns NULL in all chart types except pivot tables.

On the first column of a row segment a NULL value will be returned, as there is no column before this one.

If the table is one-dimensional or if the expression is preceded by the total qualifier, the current row segment is always equal to the entire row.

If the pivot table has multiple horizontal dimensions, the current row segment will include only columns with the same values as the current column in all dimension rows except for the row showing the last horizontal dimension of the inter field sort order. The inter field sort order for horizontal dimensions in pivot tables is defined simply by the order of the dimensions from top to bottom.

Specifying an offset greater than 1 lets you move the evaluation of expression to columns further to the left of the current column. A negative offset number will actually make the before function equivalent to a after function with the corresponding positive offset number. Specifying an offset of 0 will evaluate the expression on the current column. Recursive calls will return NULL.

By specifying a third parameter n greater than 1, the function will return not one but a range of n values, one for each of n table columns counting to the left from the original cell. In this form, the function can be used as an argument to any of the special Chart Range Functions.

Examples:

before( sum( Sales ))

before( sum( Sales ), 2 )

before( total sum( Sales ))

  

rangeavg (before(sum(x),1,3))

returns an average of the three results of the sum(x) function evaluated in the three columns immediately to the left of the current column.

Then, see this post too:

Missing Manual - Before() and After()

If you want, share your app to see your chart.

Regards!

prachisangewar
Creator
Creator
Author

Hi Manuel,

Thank you for the reply, I understand before and after functionality,my problem is with the Standard deviation to be used with the Before Function.

This formula words fine with my normal measure

Stdev(AGGR(((SUM(MEASURE)*1000000/RATE)),DATE,dim2))


But If I update it to have Before or Above function, it returns null


Stdev(AGGR(((before(SUM(MEASURE)*1000000/RATE)),1),DATE,dim2))


I have attached a sample of requirement chart.

Please let me know if you need any other details.


Thank you!



Anonymous
Not applicable

Hi prachi,

I have attached one example with before, after, below and above function.

Thanks!

Anonymous
Not applicable

before(Stdev(AGGR(((SUM(MEASURE)*1000000/RATE)),DATE,dim2)),1)

prachisangewar
Creator
Creator
Author

Hi Manuel,

Thank you for the prompt reply.

I think the Before/Above functions will not work for my case since i don't have DATE Dimension used in my second chart.

I need to compute a Standard deviation of the Difference column and it is a trend.Not sure how this can be acheived using any other method.

What i want is:

stddev(AGGR(((SUM(MEASURE)*1000000/RATE)),DATE,dim2)) - before(AGGR(((SUM(MEASURE)*1000000/RATE)),DATE,dim2))))

But the Before part does not seem to work.

Thanks for your time.Please let me know if any other suggestions.

Thank you !

Anonymous
Not applicable

Hi prachi, change your expression with the name of your expression:

stddev(AGGR(((SUM(MEASURE)*1000000/RATE)),DATE,dim2)) - before(ExpressionNameOnChart,1)

Regards

prachisangewar
Creator
Creator
Author

Hi Manuel,

Still cannot get the result. I think "Before " function cannot help as I don't have Date Dimension in the Chart.

Thanks