Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count and total count within straight table

I have the following data table loaded in my qlikview doc. The actual table has many rows with lots of products and category.

Firm NameFirm TypeProduct NameProduct CategoryFirm SizeRevenue
RAM LLCACoffeeDrug5$500
SRAM LLCBAirNature2$199
DDR LLCCAirNature1$199
SDR LLCDPoppy SeedsGrain3$82
LSD LLCDLoveMammal1$10

I'm trying to create a view that shows product penetration:

Firm TypeProduct NameFirm SizeProduct Category Average RevFirm Count (w Pdt)Firm Count TotalPenetration
ACoffee5Drug$25011100%
ACoffee4Drug$10033100%
ACoffee3Drug$754758%
ACoffee2Drug$50101566%
ACoffee1Drug$25155030%

Firm size indicates the class a firm belongs to based on their volume (5 - highest volume , 1 - lowest volume)

Firm Count (w Pdt) - Distinct count of (firms of a particular Firm Type and Firm Size Bucket that bought the product, coffee in this example)

Firm Count Total - Distinct count of (firms in a particular Firm Type and Firm Size bucket that bought any product in the  Product Category that "Coffee" belongs to, in this example it is "Drug")

Firm Count (w Pdt)  = Firm Type + Firm Size + Product Category + Product

Firm Count Total = Firm Type + Firm Size + Product Category

I built a staright table and Im struggling with the counts, have tried a lot (set analysis counts, straight counts, aggr() counts)

count ( distinct [Firm Name])

 

Count ( distinct {<[Product Line]>} {<[Firm Size]>} [Firm Name])

It would be great if someone could help. Thanks!

Please let me know if you have any additional information about this problem

7 Replies
JonnyPoole
Employee
Employee

any chance of getting a more representative data set than the 5 lines ?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Please check below expressions

For Count:

count ( distinct [Firm Name])


For Total Count:

count ( TOTAL distinct [Firm Name])


For Total Count by Product Line and Firm Size

Count ( TOTAL <[Product Line], [Firm Size]>distinct [Firm Name])


Hope this helps you.


Regards,

jagan.


Not applicable
Author

Hi Jagan,

thanks for the reply. I tried your expressions and they did not work for me. Not sure if its because of the staright table

Not applicable
Author

I'll work on creating a more detailed set and attach it here. Need to change values so company data is protected.

Not applicable
Author

Total Count is not working, 'Firm Count (w Pdt)' is working fine

Not applicable
Author

Hi Jagan/Jonathan,

Attached is a detailed data set and also my qvw file. Please let me know if there is a way I could get these counts to work.

Thanks!

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you explain in which sheet and which chart to refer?  What you exactly required.

Regards,

Jagan.