Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
BojiRigger
Contributor
Contributor

How to Aggr a RangeSum Command

I am attempting to create an expression using RangeSum command and aggr.   

I am trying to create a running % of sales by a line grouping.

The row is by Product with the Product Grouped in a higher level grouping call prodcat

In other words, I want to see the % of sales by product X the prodcat

When I enter the following, all works well.  

=(Rangesum(Above(Sum(line_total),0,RowNo(TOTAL))))/Sum(TOTAL line_total)

When I attempt to aggr by prodcat, I get sporadic results, only one row in the grouping returns a %.

=(Rangesum(Above(Sum(line_total),0,RowNo(TOTAL))))/aggr(Sum(TOTAL line_total),prodcat)

I am new to Qlikview so be gentle???  LOL

 

 

 

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

Your approach missed an outer aggregation - in this way it's rather a calculated dimension. Therefore try it in this way:

avg(aggr(Sum(TOTAL line_total),prodcat))
   or maybe with
aggr(NODISTINCT Sum(TOTAL line_total),prodcat)

- Marcus

View solution in original post

2 Replies
marcus_sommer

Your approach missed an outer aggregation - in this way it's rather a calculated dimension. Therefore try it in this way:

avg(aggr(Sum(TOTAL line_total),prodcat))
   or maybe with
aggr(NODISTINCT Sum(TOTAL line_total),prodcat)

- Marcus

BojiRigger
Contributor
Contributor
Author

Marcus, 

 

Thank you so much.  Changing divisor to   aggr(NODISTINCT Sum(TOTAL line_total),prodcat) worked perfectly.

Really appreciate the advice!

Thanks,

 

Randy