Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
neverbuyit
Contributor
Contributor

Keeping denominator per grouping the same in a pivot table in order to report percentage of each group

Hello, 

Was wondering if anyone knows what I can do in the Qlik Sense pivot table so that the denominator remains consistent for THAT GROUP and can therefore report the percentages of each accordingly. I've been having some trouble trying to figure this out and perhaps missing some piece of the formula. Using the TOTAL and ALL modifiers or their set analysis equivalents (e.g. {1}) is not what's needed as I don't want the denominator to be the entire data subset, just those in each grouping.

See the sample tables below. The first lists the raw numbers and the second converts it to its percentage. For instance, in the month of October, Status 2 for Dept 1 is 199/915 or 21.75%. Status 4 for same department is 80/915 or 8.74%

If anyone can provide a QVF with this sample data that renders the raw #'s and percentages below that would be ideal, but formula for reporting the percentages as shown  in the second table below would be great too.

Also attached the excel of the sample for reference

Raw Numbers

Year-Month2020-Oct
 TotalsStatus 1Status 2Status 3Status 4Status 5
Dept 19156291994803
Dept 29,2776,7852,157230033
Dept 32,0311,47149312532
Dept 4000000
Dept 5000-00
Dept 65,3393,8761,30691426
Dept 756,51136,86317,1521092,244142
Dept 8000-00
Dept 91,3298782791913518
Dept 1010,0776,1763,2197456345
Dept 111,5791,1294138254
Dept 121,1137692692721
Dept 1324,64817,6725,796421,07563
Dept 147,3604,5782,53622422
Dept 1513,5238,8973,9173763240
Dept 166,6014,1862,00134047
Dept 1711,8048,1483,0082261412
Dept 1810,1218,1461,6801223350
Dept 19000-00
Dept 204,1582,9421,069-13017
Dept 214,0662,5721,244323017
Dept 2214,2079,5963,7713976437
Dept 237,2064,4842,0486856541

 

Percentages

Year-Month2020-Oct
 Status 1Status 2Status 3Status 4Status 5
Dept 168.74%21.75%0.44%8.74%0.33%
Dept 273.14%23.25%0.02%3.23%0.36%
Dept 372.43%24.27%0.59%2.61%0.10%
Dept 4-----
Dept 5-----
Dept 672.60%24.46%0.17%2.66%0.11%
Dept 765.23%30.35%0.19%3.97%0.25%
Dept 8-----
Dept 966.06%20.99%1.43%10.16%1.35%
Dept 1061.29%31.94%0.73%5.59%0.45%
Dept 1171.50%26.16%0.51%1.58%0.25%
Dept 1269.09%24.17%0.18%6.47%0.09%
Dept 1371.70%23.52%0.17%4.36%0.26%
Dept 1462.20%34.46%0.03%3.29%0.03%
Dept 1565.79%28.97%0.27%4.67%0.30%
Dept 1663.41%30.31%0.05%6.12%0.11%
Dept 1769.03%25.48%0.19%5.20%0.10%
Dept 1880.49%16.60%0.12%2.30%0.49%
Dept 19-----
Dept 2070.76%25.71%-3.13%0.41%
Dept 2163.26%30.60%0.07%5.66%0.42%
Dept 2267.54%26.54%0.27%5.38%0.26%
Dept 2362.23%28.42%0.94%7.84%0.57%
2 Replies
MayilVahanan

Hi @neverbuyit 

Try like below

Sum(Total<DeptDim>CaseTicket)

or

Sum(Total<DeptDim, Year-Month>CaseTicket)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
neverbuyit
Contributor
Contributor
Author

Thanks for the response Mayil. However as mentioned i seem to run into an issue when using the TOTAL scope qualifier in this case. For instance using your suggestion and applying it to the sample tables above:

COUNT(DISTINCT TOTAL <Dept> RecID) or COUNT(DISTINCT TOTAL <Dept, Status> RecID) or COUNT(DISTINCT TOTAL <Dept, Status, Year-Month> RecID) all seem to give the total number of RecIDs which is 191,865 (sum of the "Totals" in the raw numbers table). I need the total to be at the department level, so that each status is percentage of the total per department, rather than of all possible values