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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Script Logic

Hi Group,

I have a question for all of you.  I need to get some statistics based on the following:

 

    • What % of ServLoc have 4+ MG_Key  proposed?
    • What % of ServLoc have only MG_Key = 002 proposed?
    • What % of ServLoc have only MG_Key = 004 proposed?
    • What % of ServLoc have only MG_Key = 010 proposed?
    • What % of ServLoc have MG_Key all (002, 004, 010) proposed?

Here is my table:

Oppt_Summ:
Load
ServiceLocation as ServLoc,
ContractStart_Year as Cont_Year,
Left([Material Grp],3) as MG_Key,
[Material Grp] as MGrp,
NetSales as Net_Sales
Resident Opportunity; 
 

Any ideas?

Thanks

13 Replies
tmumaw
Specialist II
Specialist II
Author

Thought it was right but I was wrong.  Here is some sample data.

   

 

tmumaw
Specialist II
Specialist II
Author

I think I resolved the previous issue by removing the ServLoc.  Any ideas on the other ones?

=

=count({<ServLoc={"=count(distinct MG_Key)>=4"}>}ServLoc) / Count(Distinct TOTAL ServLoc)   (new one)

=count({<ServLoc={"=count(distinct{<ServLoc>}MG_Key)>=4"}>}ServLoc) / Count(Distinct TOTAL ServLoc)  (old one)

tmumaw
Specialist II
Specialist II
Author

I attached some data.  Any ideas on how to get these to work?

What % of ServLoc have only MG_Key = 002 proposed?

  • What % of ServLoc have only MG_Key = 004 proposed?
  • What % of ServLoc have only MG_Key = 010 proposed?
  • What % of ServLoc have MG_Key all (002, 004, 010) proposed? !
rubenmarin

Hi Thom, maybe adding more distinct:

count(DISTINCT {<ServLoc={"=count(Distinct {<ServLoc>}MG_Key)>=4"}>}ServLoc)/Count(DISTINCT ServLoc)

Or wich ones are failing and what's the expected result?