Forum Discussion
wes-shen-poal
Helper III
9 years agoAllocate Daily Target to Calendar Dates
Hi there, I have a data table called "VMS VesselMovementVehicle" This data table consists of the following information What the data is saying is that e.g. Row 2: CDG car company has 4...
- 9 years ago
Does this help? Either that or convert the [Date Stored] col to a DATE rather than a DATETIME
Expanded Table = FILTER( CROSSJOIN(CALENDARAUTO(),'Table1') , [Date] >= 'Table1'[Date Stored] -1 && [Date] <= 'Table1'[Date Stored] + ROUNDUP('Table1'[Days to Vacate],0) ) - 9 years ago
Oh and please change the calculated column to this
End Goal = VAR DailyTarget = 'Expanded Table'[Daily Target] VAR Accum = 'Expanded Table'[Count of Cars] - CALCULATE( SUM('Expanded Table'[Daily Target]), FILTER( ALL('Expanded Table'), 'Expanded Table'[Car Company] = EARLIER('Expanded Table'[Car Company]) && 'Expanded Table'[Date] < EARLIER('Expanded Table'[Date]) && 'Expanded Table'[Ship Voyage] = EARLIER('Expanded Table'[Ship Voyage]) ) ) RETURN SWITCH(TRUE() , Accum > DailyTarget , DailyTarget , Accum < 0 , 0 , Accum )
Phil_Seamark
Microsoft Employee
9 years agoOh and please change the calculated column to this
End Goal =
VAR DailyTarget = 'Expanded Table'[Daily Target]
VAR Accum = 'Expanded Table'[Count of Cars] - CALCULATE(
SUM('Expanded Table'[Daily Target]),
FILTER(
ALL('Expanded Table'),
'Expanded Table'[Car Company] = EARLIER('Expanded Table'[Car Company])
&& 'Expanded Table'[Date] < EARLIER('Expanded Table'[Date])
&& 'Expanded Table'[Ship Voyage] = EARLIER('Expanded Table'[Ship Voyage])
)
)
RETURN SWITCH(TRUE() ,
Accum > DailyTarget , DailyTarget ,
Accum < 0 , 0 ,
Accum
) wes-shen-poal
Helper III
9 years agoThank you soooo much!!! Phil_Seamark
Now I'm going to try and understand your code to help me learn.
Really appreciate your help.