Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating yearly % in straight table

Hi All,

I am using a straight table showing below fields.

Backend contains data for all the years with its Nvalue and i am calculating Ncount using count(N_value) and achieving% using relative component.

Year      NCount     NCount%   Trend

2011       32            42.06               

2011       20            25.64

2012       20            25.64

2012        6             7.69

The query is to calculate % basis yearly contribution not dividing it basis all year counts.

Below example of the desired resultset for your ref.

Year      NCount     NCount%   Trend

2011       32            61.54             

2011       20            38.46

2012       20            76.92

2012        6             23.08

Need your assistance on  how to achieve the above output.

Thanks in advance.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This should do the trick:

Count(N_value)/Count(Total <Year> N_value)

View solution in original post

5 Replies
Anonymous
Not applicable
Author

This should do the trick:

Count(N_value)/Count(Total <Year> N_value)

Not applicable
Author

Hi

Thanks a lot, yes it worked well.:)

Thanks again.

er_mohit
Master II
Master II

hey use this expression hope it helps you

sum(DISTINCT ncount)/sum(TOTAL<year>ncount)

and in number you fixed to 2 and checked on show percent%

might be helpful for you..

see the attached file also....

Not applicable
Author

thanks its woking

er_mohit
Master II
Master II

you should have to mark it as either correct or helpful answer so that it might be helpful for other developers..