Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 joshrussin
		
			joshrussin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hey guys,
I have a pivot table that I am trying to find a way to get the Sum of "On-Time", "In-Full" as well as "On-time and In-full."
It has taken a lot to get to this point and a lot of help from the community. But I have a raw data file that I am trying to figure out what the percentages of deliveries that are On-Time and In-Full. In the attached excel file, shows the correct output I am trying to reach. In my QV file there are some expressions that I need help with. The raw data shows every item per delivery, not just deliveries. So for the Comp Pivot table, for the count of delivery, I had to do a DISTINCT for the delivery because I was getting 392 rather than the correct 19. For the other calculations I need, is there any way to get the sum based of the distinct deliveries rather than the raw item data. Here is what the output should look like.


And so far, the QV file is almost there, just need to figure out how to get the DISTINCT data per delivery for the following totals.

After those are based of the DISTINCT delivery #, I should be able to figure out the percentages below.

 
					
				
		
 vvira1316
		
			vvira1316
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Joshua,
It is caused by multiple rows for grouping by SaTy, Delivery_OTIF, Ac , and PI Date. as can be seen from attached excel file of OR Analysis
Script will have to be modified to get right result. I've simplified to get right values. You adapt it as per your need.
NoConcatenate
DataFile1:
LOAD
SaTy_OTIF & Chr(59) & Delivery_OTIF & Chr(59) & "Pl GI date_OTIF" & Chr(59) & "Ac GI date_OTIF" as "Table Key",
Material_OTIF,
Batch_OTIF,
"Delivery quantity_OTIF",
"Order Quantity_OTIF",
Delivery_OTIF,
"Pl GI date_OTIF",
"Ac GI date_OTIF",
SU_OTIF,
"Sales Doc_OTIF",
SaTy_OTIF
FROM [lib://DataFolder/OTIF Data Old_August.XLSX]
(ooxml, embedded labels, table is [RAW DATA])
;
NoConcatenate
DataFile2:
Load
Sum("Delivery quantity_OTIF") as "Sum Delivery quantity_OTIF",
Sum("Order Quantity_OTIF") as "Sum Order Quantity_OTIF",
If((Sum("Delivery quantity_OTIF") - Sum("Order Quantity_OTIF")) >= 0, 1, 0) as "Qty IF if Positive",
If((num(date([Ac GI date_OTIF]))-num(Date([Pl GI date_OTIF]))) <= 0, 1, 0) as "compare AC PI Date",
If((Sum("Delivery quantity_OTIF") - Sum("Order Quantity_OTIF")) >= 0 and
(num(date([Ac GI date_OTIF]))-num(Date([Pl GI date_OTIF]))) <= 0, 1, 0) as OTIF,
SaTy_OTIF & Chr(59) & Delivery_OTIF & Chr(59) & "Pl GI date_OTIF" & Chr(59) & "Ac GI date_OTIF" as "Table Key"
Resident DataFile1
Group By SaTy_OTIF, Delivery_OTIF, "Ac GI date_OTIF", "Pl GI date_OTIF";
Drop Table DataFile1;
 
					
				
		
 vvira1316
		
			vvira1316
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Count({<[compare AC PI Date]={1}>} distinct Delivery_OTIF)
 joshrussin
		
			joshrussin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I wonder why the IF is coming up a little differently.
 
					
				
		
 vvira1316
		
			vvira1316
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Joshua,
I'm not sure why IF is having issuebut OT is working in both cases as can be seen from screen shots.
Formulas
Count({<[compare AC PI Date]={1}>} distinct Delivery_OTIF)
/
Count(distinct Delivery_OTIF)
 joshrussin
		
			joshrussin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Same as what I'm getting. I tried the same formula that excel uses for IF, but that throws the number completely off. The way I have it, gets it pretty close. Maybe I just need to figure out a new formula. I appreciate you toughing this one out and helping me with this. I've got the IF within 1100 orders total, but still not there yet.
 
					
				
		
 vvira1316
		
			vvira1316
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		may be rounding issue for some rows. We were typing at the same time
 
					
				
		
 vvira1316
		
			vvira1316
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		For most it is matching. let's focus on where it is not matching and take raw data for those ones to try and see what may be causing it
 joshrussin
		
			joshrussin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I just went through the excel file, there are 220 IF for "OR" in the excel for sure.
Keep counting the IF in the Raw Pivot and keep coming up around 186 for them. So something is off in the original IF formula.
 joshrussin
		
			joshrussin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I have tried a few different formulas and can't seem to figure out what is causing the issue. Either I am coming up with a completely wrong number or just blanks. Have you seen anywhere this could be catching up in the raw data?
 
					
				
		
 vvira1316
		
			vvira1316
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Not yet, I was away for a while. I will keep looking
