Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
niha
Creator II
Creator II

Calculating Percentage of Total By Regionin Qliksense

Hi,

I have to calculate percentage of MSL hours by total for each region, say in a Table or Treemap.

1. Dimension- Region,

2. Dimension -Task (Fixed to Top 20 ).

3. Measure is : =(sum({<FM={'MSL'}>}Q1hours)+sum({<FM={'MSL'}>}Q2hours)+sum({<FM={'MSL'}>}Q3hours)+sum({<FM={'MSL'}>}Q4hours)) /
(sum(total{<FM={'MSL'}>}Q1hours)+sum(total{<FM ={'MSL'}>}Q2hours)+sum(total{<FM ={'MSL'}>}Q3hours)+ sum(total{<FM ={'MSL'}>}Q4hours))

This gives me a decimal values and I convert it to Percentage. 

I need to add Region also in code not sure how to do. 

With above code I got below Screen Shot Untitled.png

When I select Region in dashboard  The Region as EMEA , the shot comes like below and  that is what I want to be displayed. 

Untitled2.png

How should I display the data without selecting Region as filter in dashboard but rather as code in measure. 

Regards,

Niha

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Try this measure

=(sum({<FM={'MSL'}>}Q1hours)+sum({<FM={'MSL'}>}Q2hours)+sum({<FM={'MSL'}>}Q3hours)+sum({<FM={'MSL'}>}Q4hours)) /
(sum(total <Region> {<FM={'MSL'}>}Q1hours)+sum(total <Region>{<FM ={'MSL'}>}Q2hours)+sum(total<Region>{<FM ={'MSL'}>}Q3hours)+ sum(total<Region>{<FM ={'MSL'}>}Q4hours))

View solution in original post

2 Replies
Vegar
MVP
MVP

Try this measure

=(sum({<FM={'MSL'}>}Q1hours)+sum({<FM={'MSL'}>}Q2hours)+sum({<FM={'MSL'}>}Q3hours)+sum({<FM={'MSL'}>}Q4hours)) /
(sum(total <Region> {<FM={'MSL'}>}Q1hours)+sum(total <Region>{<FM ={'MSL'}>}Q2hours)+sum(total<Region>{<FM ={'MSL'}>}Q3hours)+ sum(total<Region>{<FM ={'MSL'}>}Q4hours))

niha
Creator II
Creator II
Author

Worked!