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: 
nvrphanikumar
Creator
Creator

SubTotals

HI

Lets say, You want to show % of Male and Female for each Month like below.


# = count(EmployeeID)

Subtotal = count( total <Month> EmployeeID)

% =  # / Subtotal for each Month.

   

MaleFemale
#Subtotal%#Subtotal%
Jan51145.45%61154.55%
Feb31030.00%71070.00%
March4944.44%5955.56%
April51145.45%61154.55%
May61346.15%71353.85%
June71546.67%81553.33%
July81747.06%91752.94%
August91947.37%101952.63%
September102147.62%112152.38%
October112347.83%122352.17%
November122548.00%132552.00%
December132748.15%142751.85%


These formula's mentioned above work fine with right numbers.



Lets say in the above example ,The user asked to limit the results by Default to Jan and Feb


My row expression is :

if(match(Month, 'Jan','Feb'),Month) .

and I countinue to use existing calculations, the results doesn't show right.They appear as below. You will notice Subtotal brings total for table mentioned above for all months instead of subtotal for Jan and Feb as It used to in above example.

# = count(EmployeeID)

Subtotal = count( total <Month> EmployeeID)

% =  # / Subtotal for each Month.

   

MaleFemale
#Subtotal%#Subtotal%SubTotal
Jan52012.4962012.9911
Feb32011.4972013.4810
1 Solution

Accepted Solutions
hector_munoz
Specialist
Specialist

OK, try to not use calculated dimension just Month, and use the following expresions instead yours:

# = Sum({<Month={Jan,Feb}>} Employees)

Subtotal = Sum({<Month={Jan,Feb}>} TOTAL <Month> Employees)

% =  Sum({<Month={Jan,Feb}>} Employees) / Sum({<Month={Jan,Feb}>} TOTAL <Month> Employees)

Regards,

H

View solution in original post

4 Replies
hector_munoz
Specialist
Specialist

Hi Phani,

Use set analysis in expressions instead of calculated dimensions:

# = Sum({<Month={Jan,Feb}>} Employees)

Subtotal = Sum({<Month={Jan,Feb}>} TOTAL <Month> Employees)

% =  Sum({<Month={Jan,Feb}>} Employees) / Sum({<Month={Jan,Feb}>} TOTAL <Month> Employees)


I attach you a sample with data similar to yours.


Regards,H

nvrphanikumar
Creator
Creator
Author

HI Hector,

Thanks for your response,I tried to replicate it and Subtotal is still showing full total instead of total for each month.

Have you limited the rows to if(match(Month, 'Jan','Feb'),Month) ?

Sorry,I'm using qlik sense and couldn't open qvw file.

Thank you

hector_munoz
Specialist
Specialist

OK, try to not use calculated dimension just Month, and use the following expresions instead yours:

# = Sum({<Month={Jan,Feb}>} Employees)

Subtotal = Sum({<Month={Jan,Feb}>} TOTAL <Month> Employees)

% =  Sum({<Month={Jan,Feb}>} Employees) / Sum({<Month={Jan,Feb}>} TOTAL <Month> Employees)

Regards,

H

nvrphanikumar
Creator
Creator
Author

Thank you!