Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Marcel_Garcia
Contributor III
Contributor III

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.

Labels (4)
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 III
Contributor III
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 III
Contributor III
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])