Forum Discussion
Bcomm_student
6 months agoRegular Visitor
Calculating Days late with specific target times
Part of an assignment for university is making a table for some data showing delivery days and days late, and we only need to show values for the ones that were actually late. I have this table: ...
- 6 months ago
Hi,
Write this calculated column formula in the Regions table
Target = 1*(LEFT(Regions[Target Days],SEARCH(" ",Regions[Target Days])-1))Write these calculated columns in the Data table
Diff = 1*('Data'[Delivery Date]-'Data'[Order Date])Target = CALCULATE(MAX(Regions[Target]),FILTER('Regions','Data'[Customer Province]='Regions'[Location]))Column 2 = if(Data[Diff]<Data[Target],"early",if(Data[Diff]=Data[Target],"on time","late"))Hope this helps.
Bcomm_student
6 months agoRegular Visitor
I'm not sure how to send files in replies but I get an error with that formula. Maybe I need to get rid of the Region group from before transforming the data?
Ashish_Mathur
Super User
6 months agoHi,
Write this calculated column formula in the Regions table
Target = 1*(LEFT(Regions[Target Days],SEARCH(" ",Regions[Target Days])-1))
Write these calculated columns in the Data table
Diff = 1*('Data'[Delivery Date]-'Data'[Order Date])Target = CALCULATE(MAX(Regions[Target]),FILTER('Regions','Data'[Customer Province]='Regions'[Location]))Column 2 = if(Data[Diff]<Data[Target],"early",if(Data[Diff]=Data[Target],"on time","late"))
Hope this helps.