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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
fislar20
Contributor II
Contributor II

Count function Question

I have a formula written into a Measure that produces an acceptable outcome.

Here is the formula.

if(max([Ship Year])='2020','Current',if(max([Ship Year])='2019','Lost','Gone'))

 

I am trying to understand the right chart to add that will show the count of each of the 3 types   (Current,Lost, Gone)

What chart type do I use and how is the count function written?

 

Thank you!

 

 

4 Replies
jochem_zw
Employee
Employee

use this expression as Dimension field:

if([Ship Year]='2020','Current',if([Ship Year]='2019','Lost','Gone')

and as a expression use the count 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm assuming that you are counting something like Customers (I'll assume a field "CustomerId") that have multiple ship years.  Use a calculated dimension with an Aggr like:

Aggr( if(max([Ship Year])='2020','Current',if(max([Ship Year])='2019','Lost','Gone')), CustomerId)

and a measure like:

Count(CustomerId)

You can use a table, bar or pie chart.

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

fislar20
Contributor II
Contributor II
Author

Here is what I have.

In my Table,

I have by 5 dimensions

Sales Rep

Sales Division

Customer

Customer Number

Product

Then I have 5 measures

Last Ship Date =      max([Ship Date])

First Ship Date =      min([Ship Date])

Total No. Of Invoices =      count([Invoice No.])

Product Business Status =     if(Min([Ship Year])=2020,'New','Old')

Product Status =                   if(max([Ship Year])='2020','Current',if(max([Ship Year])='2019','Lost','Gone'))

 

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Make a new table chart. 

Dimension will be a formula: 

=Aggr( if(max([Ship Year])='2020','Current',if(max([Ship Year])='2019','Lost','Gone')),[Customer Number])

Measure:

Count(DISTINCT [Customer Number])

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com