Skip to main content

New to Qlik Sense

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

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
spook2020202
Contributor III
Contributor III

Filtering data in an expression

Hi,
I'm trying to calculate the percent that a scoreline appears for any particular league but am having trouble with the calculation.
As you can see from the screenshot below, the figure against each scoreline is how many times that scoreline appeared for each particular league.
What I'm trying to do is have that figure as a percent but i'm struggling when trying to do the calculation to only use the games that were played for that league.
EG, Bundesliga 1 had 400 games played in total. so for the scoreline of 0-0 which occurred 57 times, the percent should be 14.25 (57/400).
However, my expression is doing 57/17018 which is the total games played across all leagues. Is anyone able to demonstrate how to do the calculation only based on total matches for each league instead of total matches for all leagues?

Thanks
image.png

1 Solution

Accepted Solutions
spook2020202
Contributor III
Contributor III
Author

Managed to get it working using:
Num(Count({$<fulltime ={'0-0'}>} fixture_id)/count(fixture_id)*100,'##.##')
I've added a seperate measure for each scoreline up to 2-2 which gives me what i need.
Thanks.

View solution in original post

2 Replies
rogerpegler
Creator II
Creator II

If your current expression is say Count(MatchID) then try:

Count(MatchID)/Count(TOTAL <[League Name]>  MatchID)

spook2020202
Contributor III
Contributor III
Author

Managed to get it working using:
Num(Count({$<fulltime ={'0-0'}>} fixture_id)/count(fixture_id)*100,'##.##')
I've added a seperate measure for each scoreline up to 2-2 which gives me what i need.
Thanks.