Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Shivam22
		
			Shivam22
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi All,
I have a data set like below and i need create a textbox to count distinct ID where any of values from test1 to test4 is 1 and other textbox showing count with any of values from test1 to test4 is 0, without counting them twice.
For example - Count(any of values from test1 to test4 is 1) = 5
Count(any of values from test1 to test4 is 0) = 2
| ID | test1 | test2 | test2 | test4 | 
| AAA | 1 | 0 | 1 | 0 | 
| BBB | 1 | 1 | 1 | 1 | 
| CCC | 1 | 0 | 1 | 0 | 
| DDD | 0 | 1 | 0 | 1 | 
| EEE | 1 | 1 | 1 | 1 | 
| FFF | 0 | 0 | 0 | 0 | 
| GGG | 0 | 0 | 0 | 0 | 
Can anyone pls help me understand how to achieve this?
Thanks in Advance
 Chanty4u
		
			Chanty4u
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this for any 1
=Count(DISTINCT {<ID = {"=Sum(test1+test2+test3+test4) > 0"}>} ID)
Try this for any 0
=Count(DISTINCT {<ID = {"=Sum(test1+test2+test3+test4) = 0"}>} ID)
Or you can try this way
=Count(DISTINCT If(test1 = 1 or test2 = 1 or test3 = 1 or test4 = 1, ID))
For all 0
=Count(DISTINCT If(test1 = 0 and test2 = 0 and test3 = 0 and test4 = 0, ID))
 
					
				
		
 Or
		
			Or
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This would be a union, seemingly.
{< test1 = {1} + test2 = {1} + test3 = {1} + test4 = {1} >}
 marksouzacosta
		
			marksouzacosta
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi @Shivam22 ,
You can also change your Load Script to facilitate the chart measure:
TestData:
Load 
    ID,
    test1,
    test2,
    test3,
    test4,
    If(RangeSum(test1,test2,test3,test4) = 0,0,1) AS CountFlag
Inline [
ID, test1, test2, test3, test4
AAA, 1, 0, 1, 0
BBB, 1, 1, 1, 1
CCC, 1, 0, 1, 0
DDD, 0, 1, 0, 1
EEE, 1, 1, 1, 1
FFF, 0, 0, 0, 0
GGG, 0, 0, 0, 0
];
The Measures will be like:
Regards,
Mark Costa
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
 Chanty4u
		
			Chanty4u
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this for any 1
=Count(DISTINCT {<ID = {"=Sum(test1+test2+test3+test4) > 0"}>} ID)
Try this for any 0
=Count(DISTINCT {<ID = {"=Sum(test1+test2+test3+test4) = 0"}>} ID)
Or you can try this way
=Count(DISTINCT If(test1 = 1 or test2 = 1 or test3 = 1 or test4 = 1, ID))
For all 0
=Count(DISTINCT If(test1 = 0 and test2 = 0 and test3 = 0 and test4 = 0, ID))
