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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Formula with count function in Qlik Script

Hi,

Need urgent help here.

I need to create a formula for each item that equals 1/Number of times that item appears in table. Example:

   

ItemFormula
A1/(Count of times A appears)=1/4
A1/(Count of times A appears)=1/4
A1/(Count of times A appears)=1/4
A1/(Count of times A appears)=1/4
B1/(count of times B appears)=1/2
B1/(count of times B appears)=1/2

What is the easiest way to do this?

I tried creating a mapping table that counts Items and mapping it back to the original table but it is not working (sometimes the denominators are way too big). Any other way quick way to do this?

13 Replies
Anonymous
Not applicable
Author

I pulled out every single field from my database to get all the rows with no filters and I still saw only 11 rows for that item, so where would 51 come from?

sunny_talwar

I won't be able to tell you much because I don't have your app to look at. May be you can share a sample or share some images.

MarcoWedel

which object did you use to display those 11 rows?

muthukumar77
Partner - Creator III
Partner - Creator III

Table:

LOAD RowNo() AS ID, * INLINE [

Item

A

A

A

A

B

B

];


Try like this,

Dimension: ID, Item

Expression: 1/Count(Total <Item> Item)



Muthukumar Pandiyan