Forum Discussion
DATEDIFF When Usinf IF Argument
Well, if this is a measure, you are going to need to have an aggregation like MIN or MAX around your column. I think you want something like:
CAPA Planning Days =
IF(
MAX(CAPATable[Record_Source]) = “Audit”, // true/false statement
DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY), //true
"This is the false part" //false
)Thanks for the response but when I enter the new argument I get the following error message: Too few arguments were passed to the IF function. The minimum argument count for the function is 2.
- RichBurdick6 years ago
Helper I
Maybe more information would help. I am trying to create a measure with the following criteria
If Record Source = Audit (DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY)) and (DATEDIFF(MIN(CAPAtable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY)) OR If Record Source = Quality Issue (DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED], MAX(CAPATable[CAPA_PLAN_APPROVAL_ON]), DAY))- Greg_Deckler6 years ago
Community Champion
So that generally means there is a missing paren somewhere. I do not understand your last post at all. If the record source = audit then a datediff and another datediff? I am not understanding something. Are you adding those datediffs together?
- RichBurdick6 years ago
Helper I
So basicaly I need to make one of three different calculations based on the record source. If the record source is from an audit it can be either one of the two calculations but if the record source is a quality issue use that calculation.