Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi Everyone,
I have created a straight Table for sales calculation with respect to billing days. I have loaded the Billing and Sales values per year and country wise and I have used the division formula (i.e [Sales to date}/[Billing Days to Date]) to perform the calculation to show the final sales in the respective years. The problem now is, the formula works fine for individual sales vs billing days and gives the correct output. But when it comes to the totals the division operation is not performing well. Can anyone please tell me where I might be doing the mistake. I am attaching the screenshot for reference.
Thanks in advance.
 Gysbert_Wassena
		
			Gysbert_WassenaOk, try this expression:
=sum(aggr(if(Year=year(Date1),
sum({<Date={">=$(=vStartDate)<=$(=vEndDate)"},year=>}Sales),
sum({<Date={">=$(=Vprestdate)<=$(=Vpreendate)"},year=>}Sales)
),Country,Year))
/
sum(aggr(sum({<Date1={">=$(vStartDate)<=$(vEndDate)"}>}[Billing Day]),Country,Year))
 
					
				
		
 awhitfield
		
			awhitfield
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi uday,
can you upload a sample qvw and source data please?
Andy
 Kushal_Chawda
		
			Kushal_Chawda
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You need to use the Aggr function which will aggregate the values based on dimension.
As you are using the cyclic group, you can use Aggr function with Getcurrentfield fucntion
Try,
=sum(aggr(sum([Sales to date]),$(=GetCurrentField(YourCyclicGroupName))))/
sum(aggr(sum([Billing Days to date]),$(=GetCurrentField(YourCyclicGroupName))))
 Gysbert_Wassena
		
			Gysbert_WassenaTry setting the Total mode of that expression to Sum of rows instead of Expression Total.
 
					
				
		
I have set the total mode as sum of rows for Sales to date and Billing days to date, but for the final sales calculation I have set the total mode to Expression total, as I want even the total of "Final Sales Calculation" to be the divided value of the "Billing days to date total " and "Sales to date Total". If I set all of them to sum of rows, I get only the sum of Final sales calculation which is not the requirement.
 
					
				
		
Hi Kush,
The expression you gave did not work. Instead it is returning the nulls.
 Gysbert_Wassena
		
			Gysbert_WassenaChange your expression to: sum([Sales to date])/sum(Billing Days to Date])
 Kushal_Chawda
		
			Kushal_Chawda
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		UdayKiran it should work. Have you correctly entered your cyclic group name?
or please share the screenshot of your expression
 
					
				
		
In total mode Keep sum of rows for the expression: [Sales to date}/[Billing Days to Date]) and for other exprs keep Expressions Total and try..
 
					
				
		
It has returned NULL.
