Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Marcel_Garcia
Contributor II
Contributor II

How to avoid double counting key Ids in the sum of different counts functions

Hi,

I have a master measure that sums different counts like:

Count(condition1, key_id) + Count(condition2, key_id2) + ...

I use it in a total column from a table.

How could I avoid double counting key_ids that I already count in previous conditions.

Thanks.

1 Solution

Accepted Solutions
sunny_talwar

May be try this

=Count({$<[test_product]={'FTTC3'}, [speed_brag_v1]={'Excellent','Good','Very Good'}, [stability_brag_v2]={'Blue','Green','Pink'}>+
		$<[initial_lt_diagnosis_code]={'GTC_FTTC_SERVICE_1202','GTC_FTTC_SERVICE_1203','GTC_FTTC_SERVICE_1204'}>+
		$<[OUTCOME_CODE]={'ASSOCIATE_1000', 'ASSOCIATE_1002', 'ASSOCIATE_1003'}>+
		$<[initial_lt_diagnosis_code]={'GTC_FTTC_SERVICE_1614'}>+
		$<OUTCOME_CODE={'GTC_TEST_4006','GTC_TEST_3002','GTC_TEST_4004','GTC_TEST_4002','GTC_TEST_3001','GTC_TEST_4001','GTC_TEST_4019','GTC_TEST_4005','GTC_TEST_4020','GTC_TEST_4021'}>+
		$<[ds_line_rate_at_product_cap]={'Y'}>}[siebel_fault_id])

View solution in original post

4 Replies
vishsaggi
Champion III
Champion III

Can you share your full expression to look into?

Marcel_Garcia
Contributor II
Contributor II
Author

Count({$<[test_product]={'FTTC3'}, [speed_brag_v1]={'Excellent','Good','Very Good'}, [stability_brag_v2]={'Blue','Green','Pink'}>}[siebel_fault_id])+
Count({$<[initial_lt_diagnosis_code]={'GTC_FTTC_SERVICE_1202','GTC_FTTC_SERVICE_1203','GTC_FTTC_SERVICE_1204'}>}[siebel_fault_id])+
Count({$<[OUTCOME_CODE]={'ASSOCIATE_1000', 'ASSOCIATE_1002', 'ASSOCIATE_1003'}>}[siebel_fault_id])+
Count({$<[initial_lt_diagnosis_code]={'GTC_FTTC_SERVICE_1614'}>}[siebel_fault_id])+
Count({$<OUTCOME_CODE={'GTC_TEST_4006','GTC_TEST_3002','GTC_TEST_4004','GTC_TEST_4002','GTC_TEST_3001','GTC_TEST_4001','GTC_TEST_4019','GTC_TEST_4005','GTC_TEST_4020','GTC_TEST_4021'}>}[siebel_fault_id])+
Count({$<[ds_line_rate_at_product_cap]={'Y'}>}[siebel_fault_id])

I was trying something like Count( Distinct IF(condition1 OR condition2....), [siebel_fault_id])

Marcel_Garcia
Contributor II
Contributor II
Author

I have each 'count' in a different master measure if it helps

sunny_talwar

May be try this

=Count({$<[test_product]={'FTTC3'}, [speed_brag_v1]={'Excellent','Good','Very Good'}, [stability_brag_v2]={'Blue','Green','Pink'}>+
		$<[initial_lt_diagnosis_code]={'GTC_FTTC_SERVICE_1202','GTC_FTTC_SERVICE_1203','GTC_FTTC_SERVICE_1204'}>+
		$<[OUTCOME_CODE]={'ASSOCIATE_1000', 'ASSOCIATE_1002', 'ASSOCIATE_1003'}>+
		$<[initial_lt_diagnosis_code]={'GTC_FTTC_SERVICE_1614'}>+
		$<OUTCOME_CODE={'GTC_TEST_4006','GTC_TEST_3002','GTC_TEST_4004','GTC_TEST_4002','GTC_TEST_3001','GTC_TEST_4001','GTC_TEST_4019','GTC_TEST_4005','GTC_TEST_4020','GTC_TEST_4021'}>+
		$<[ds_line_rate_at_product_cap]={'Y'}>}[siebel_fault_id])

View solution in original post