# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$400 before Dec 31st: REGISTER NOW!
cancel
Showing results for
Did you mean:
Contributor III

## Counting as a percentage of total

I have training data for users, in the following format

course title, user_id

When i create a table, i can easily show

Course Title, Total of users assigned to that course

But i'd also like to add a third column (% of total unique users assigned to that course)

So if i had 50 users, 10 on that course the data would read

Course A, 10, 20%

I'm trying to work out how to do this because qlik restricts the row data down to "course a" so not sure how to count outside that restriction to get the % ?

Thanks

9 Replies

@DMG  can you share a sample data and the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Specialist

Hi,

=count(course)/50*100

Contributor III
Author

Something like this

User, Course,
A, First Aid
B, First Aid
C, First Aid
A, Security
D, Security

So the expected response would be

Course, number of assigned users, percentage that number of assigned users is off the total users

First Aid, 3, 75%
Security, 2, 50%

As they are four users (A-D) and two courses

The course numbers and users can change, the idea is to be able to have a table that shows the course name, number of assigned users, and the percentage that number is of the total number of users (in this case 4).

Because qlik restricts the row data down as soon as the first column is Course, i'm not sure how to be able to access the total user value of 4 so i can work out the percentage of total users.

Contributor III
Author

Thanks but that wont work as the number of users and courses can vary dynamically.

Specialist

Hi,

Aggr(Count(course), course/Distinct (user)*100

Specialist

Hi,

(Aggr(Count(course),course)/distinct (user))*100

Specialist II

Your denominator should use TOTAL.  You don't need aggr.

Count(user_id) / Count(Total user_id).

FYI - if you need to set your aggregation to different levels you can do Total <field1, field2, fieldn>  but in this case you only need the global total.

Specialist

Hi,

Aggr(count(course),cou cou)/count(total distinct (user))*100

It gives requester result. Verified ok

Specialist II

ok good, but you shouldn't need the outer aggr().

Tags
Community Browser