Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
IMPORTANT: Upcoming LEF Database Maintenance, Oct. 3rd - SEE DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Line graph doesnt count total to date

Hi I am using data which kinda looks like this:

category         week

1                        1

2                        1

1                       3

1                       4

2                       6

Now, I want a line graph that shows percentage of 2's.

so for week 1 - 50%, week 2 - 50%, week 3 - 33.33%, week 4 - 25%, week 5 - 25%, week 6 - 40% and so on. The values I am currently getting are:

 

week 1 - 50%, week 2  -0%, week 3 - 0, week 4 - 0 week 5 - 0, week 6 - 100%

 

can this be done? Thanks!

 

1 Solution

Accepted Solutions
Highlighted
Creator
Creator

Okay now I get it. You need cumulative sums with rangesum(above())

 

Try this as measure with week as dimension:

RangeSum(Above((count(if(category = 2,1))),0,RowNo()))
/RangeSum(Above(count(if(category,1)),0,RowNo()))

 

View solution in original post

4 Replies
Highlighted
Specialist
Specialist

Can u explain a bit more about your calculation condition? How do you want 50% for 2's ?

Highlighted
Contributor III
Contributor III

i assume you are getting confused over the week 1 values. there are 2 entries for week 1, but only one of them is category 2, thats why i get 50% in that. in week 2 there are no new entries so the value remains 50%. In week 3 an entry is added in category 1, now the total no. of entries will be 3, and only one of them will be of category 2, hence 33.33% and so on.

Highlighted
Creator
Creator

Okay now I get it. You need cumulative sums with rangesum(above())

 

Try this as measure with week as dimension:

RangeSum(Above((count(if(category = 2,1))),0,RowNo()))
/RangeSum(Above(count(if(category,1)),0,RowNo()))

 

View solution in original post

Highlighted
Contributor III
Contributor III

thanks mate!!!