Empresa: NYK
Gestor: Bruno
Projeto: OCP

OCP Documentation:
The Tech Guide as well as the documentation written down has been put together to serve as support material for technical professionals who have in-depth knowledge of:
> The tool
> Calculus
> Programming & Logic
> The business
!
TimeTable measures
These measures calculate the datetimes for a specific port by checking two different tables: f_TM-REAL and f_TM-PROJECTION. Here's a breakdown:
1. IF Statement:
The expression starts with an IF function, which is used to evaluate a condition and return one value if the condition is true and another if it is false.
2. First CALCULATE Function (Condition):
Purpose: The CALCULATE function sums the datetime from the f_TM-REAL table.
Condition: It filters the data where the PORT_ID in f_TM-REAL matches the maximum PORT1_ID from the d_TABLE-PORTS table.
Logic: The IF function checks if this sum equals 0.
3. True Result (When the Sum is 0):
If the sum of datetime from the f_TM-REAL table targeted in the DAX is 0, the IF function returns the result of another CALCULATE function.
Calculation: It sums the datetime from the f_TM-PROJECTION table.
Condition: It filters the data where PORT_ID in f_TM-PROJECTION matches the maximum PORT_ID from the d_TABLE-PORTS table.
4. False Result (When the Sum is Not 0):
If the sum is not 0, the IF function returns the same value that was calculated in the condition, i.e., the sum of the datetime from the f_TM-REAL table where PORT_ID matches the maximum PORT_ID.
Summary:
The TimeTable measures check whether the f_TM-REAL table has a valid datetime for that OP stage at the specific port.
If it does, it returns that date.
If not, it defaults to the projected datetime from the f_TM-PROJECTION table.
The formula essentially prioritizes real data (f_TM-REAL) but falls back on projected data (f_TM-PROJECTION) if no real data is available.
Timetable Color Measure
These measures calculates a color code based on the datetimes from the f_TM-REAL table for a specific port. Here's a breakdown:
1. CALCULATE Function:
Purpose: The CALCULATE function is used to sum datetimes from the f_TM-REAL table.
Condition: It filters the data where the PORT_ID in f_TM-REAL matches the maximum PORT_ID from the d_TABLE-PORTS table.
2. SUM Function:
The SUM function within CALCULATE aggregates the values of datetimes that meet the filter condition.
3. CONVERT Function:
Purpose: The CONVERT function changes the data type of the result from the CALCULATE function.
Conversion: It converts the sum of datetimes to an integer using the INTEGER data type.
Summary:
The formula sums datetimes for a specific port.
It then converts this sum to an integer.
This integer is used as a color code that conditionally changes cards color to blue if value is greater than 0.