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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
raghavsurya
Partner - Specialist
Partner - Specialist

Need to calculate relative percentage at sub total level


Hi All,

We have a requirement wherein the user wants to know the relative percentage of total product sold at each location level.  I am currently using Pivot table to achive the result and using the below expression

num(Sum({<DateID={$(=Max(DateID))} >}PWSalesValue))

/Sum({<DateID={$(=Max(DateID))}>}total PWSalesValue),'#.#%')

when I do this the relative % is getting calculated using all the location and not for each location.  Is there a way How I can achieve the result shown below.

LocationProduct NameApr-14 ActualRelative %
BangaloreA4,84612%
B11,88530%
C 22,86158%
D 0%
Total39,592100%
HyderabadA7714%
B4,71324%
C 13,96672%
D 0%
E170%
Total19,466100%
MumbaiA99839%
B1466%
C 33213%
D49919%
E60023%
Total2,575100%
1,74,758
1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Use below as second expression

SUM([Apr-14 Actual])/SUM(TOTAL <Location> [Apr-14 Actual])

================

Pivot Table

Dimension

Location

Product Name

Expression

SUM([Apr-14 Actual])

SUM([Apr-14 Actual])/SUM(TOTAL <Location> [Apr-14 Actual])

or

SUM(Sales)

SUM(Sales)/SUM(TOTAL <Location> Sales)

View solution in original post

4 Replies
MK_QSL
MVP
MVP

Use below as second expression

SUM([Apr-14 Actual])/SUM(TOTAL <Location> [Apr-14 Actual])

================

Pivot Table

Dimension

Location

Product Name

Expression

SUM([Apr-14 Actual])

SUM([Apr-14 Actual])/SUM(TOTAL <Location> [Apr-14 Actual])

or

SUM(Sales)

SUM(Sales)/SUM(TOTAL <Location> Sales)

satishkurra
Specialist II
Specialist II

Hi

Please follow below navigation.

1. Create a new pivot table with Location and Product Name as dimensions.

2. Add the following expressions

3. a. Sum(Sales)

    b. Sum(Sales) / Sum(TOTAL Sales)

    c. Sum(Sales) / Sum(TOTAL<Location> Sales)

4. Go to Presentation Tab for the dimensions, Please check Show Partial Sums option

5. Go to Number Tab and for expression a, please select number format settings as Integer, for expression b & c, please select Number Format as Fixed to Decimals and Check Show in Percent (%) option

6. Now you will get the desired graph

Note: Please don't take straight table, as it will be for sorting. Use PIVOT only for better grouping.

Thanks

Satish

raghavsurya
Partner - Specialist
Partner - Specialist
Author

thanks a lot Manish.  It worked for me.

CELAMBARASAN
Partner - Champion
Partner - Champion

Try this expression

num(Sum({<DateID={$(=Max(DateID))} >}PWSalesValue))

/Sum({<DateID={$(=Max(DateID))}>}Total<LocationFieldName> PWSalesValue),'#.#%')