Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I’m trying to calculate the number of Days an Order took from BDate to CDate based on the “Date” field. If the” Date” is blank then need to ignore that Order. The below expression is calculating the days correctly for most cases but when the Order has either only BDate or CDate it’s not calculating it correctly. There should be value for both BDate and CDate, if either BDate or CDate is blank then need to ignore that order.
For example in the attached qvw and excel Order PTC has only CDate, BDate is blank so this order should be ignored. I tried to write the following expression but it’s not working. Please can someone help me with the expression? Thanks,
Ramya
Just add the null condition at the start of your IF condition like the below
Max(Aggr(
if( isnull(min(BDate))=0 and isnull(min(CDate))=0 ,
IF(InQuarter(min(CDate), Quarter_Start, 0) AND InQuarter(min([BDate]), Quarter_Start, 0), min(CDate) - min([BDate]),
IF (InQuarter(min(CDate), Quarter_Start, 0), min(CDate) - Quarter_Start,
IF (InQuarter(min([BDate]), Quarter_Start, 0), DayStart(Quarter_End) - min([BDate]),
IF (not(InQuarter(min(CDate), Quarter_Start, 0)) and not(InQuarter(min([BDate]), Quarter_Start, 0)) and min(CDate) > Quarter_Start and min([BDate]) < Quarter_End, Quarter_End - Quarter_Start
))))), Year, Order))
Just add the null condition at the start of your IF condition like the below
Max(Aggr(
if( isnull(min(BDate))=0 and isnull(min(CDate))=0 ,
IF(InQuarter(min(CDate), Quarter_Start, 0) AND InQuarter(min([BDate]), Quarter_Start, 0), min(CDate) - min([BDate]),
IF (InQuarter(min(CDate), Quarter_Start, 0), min(CDate) - Quarter_Start,
IF (InQuarter(min([BDate]), Quarter_Start, 0), DayStart(Quarter_End) - min([BDate]),
IF (not(InQuarter(min(CDate), Quarter_Start, 0)) and not(InQuarter(min([BDate]), Quarter_Start, 0)) and min(CDate) > Quarter_Start and min([BDate]) < Quarter_End, Quarter_End - Quarter_Start
))))), Year, Order))
Thank you so much Susant.
Ramya