Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 profilejamesbon
		
			profilejamesbonHi,
I have "data source a" from 01.01.2025 to 28.06.2025 and "data source b" from 29.06.2025 to today()-1.
I have % Expression to calculate KPI:
num(
Sum({<Source = {'A'}>} Column A) / (Sum({<Source = {'A'}>} Column B) - Sum({<Source = {'A'}>} Column C))
+
Sum({<Source = {'B'}>} Column A) / (Sum({<Source = {'B'}>} Column B) - Sum({<Source = {'B'}>} Column D))
,'#0,0 %')
Source = {'A'} used Column C while Source = {'B'} used Column D to calculate the %.
Now, the problem is Source = {'A'} returns me 60% while Source = {'B'} returns me 70% and sum up is 130% which is not correct. While both expressions are correct and returns me the result based on number for Column A, B, C, and D.
How to fix this logical issue ?
Thanks
 
					
				
		
 Or
		
			Or
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Your If() should be inside the Sum(), but it seems to be summing Column C either way so I'm not sure it matters? Or is that a typo?
Sum(If (Data Source = A, Column C,Column D))
Or
Sum(Pick(Match(Data Source,A,B),Column C, Column D))
 
					
				
		
 Or
		
			Or
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		No idea what exactly you're trying to achieve, but why are you summing the values in the first place? Shouldn't you be averaging them or subtracting them? This expression is confusing...
 profilejamesbon
		
			profilejamesbonHi,
I am summing up due to the 2 reason:
1. Both expressions are different due to availability of the data. For example: Source A has Column C while Source B has Column D in the calculation
2. Before 29.06.2025 was data labeled with Source A and after that Source B. So, the idea is to show the values when user Select 01.01.2025 with the Source A Expression and if the user Select After 29.06.2025 then it must see the calculation based on Expression 2. And if there is no selection then calculated based on Expression.
Thanks
 
					
				
		
 Or
		
			Or
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I'm afraid I'm still struggling to follow the logic / formula / explanation.
{A} returns 60%, {B} returns 70%, you say both values are correct, yet 130% is not correct despite the fact that you are performing a simple addition between A and B?
 profilejamesbon
		
			profilejamesbonLet me make it more simple,
I have two fields which needs to be switch in the Expression:
I want to change the column or swap the column for Data Source ?
Current Expression:
Sum(Column A) / (Sum(Column B) - Sum(Column C))
New Expression:
Sum(Column A) / (Sum(Column B) - If (Data Source = A, Sum(Column C), If(Data Source = B, Sum(Column C))))
Somehow, new expression is not working or may be there is a logical error.
 
					
				
		
 Or
		
			Or
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Your If() should be inside the Sum(), but it seems to be summing Column C either way so I'm not sure it matters? Or is that a typo?
Sum(If (Data Source = A, Column C,Column D))
Or
Sum(Pick(Match(Data Source,A,B),Column C, Column D))
