Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Smart people needed (a date classification issue)

Hi All,   I have a kind of classification issue. Our department wants to distinguish between New and Existing (bestaande) business. - New Business is classified as the first date on which there is...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi Vvelarde,

    Thank you very much, we are almost there. 

    This works wonderful for a database with a single client. But we encounter a database with multiple clients, thus we have to add another argument to the formula. Something like:

    Easyflex_data[RlIdNr] = EARLIER(Easyflex_data[RlIdNr]

    I'm trying to add this to your min +365 formula, but i can't figure out how to add a second filter argument:

    MinDate + 365 = 
    VAR _ContextDate= Easyflex_data[ndate]
    VAR FilteredTable= FILTER(Easyflex_data;Easyflex_data[ndate] <= _ContextDate && Easyflex_data[Discontinued]="Yes")
    VAR _Exist_PreviousDiscountinued = COUNTROWS(FilteredTable)
    VAR Result = If (_Exist_PreviousDiscountinued > 0; CALCULATE(MAX(Easyflex_data[ndate]);TOPN(1;FilteredTable;[ndate];DESC));Easyflex_data[MinDate EF])
    RETURN
    Result + 365

     Like this?

     FILTER(ALL(Easyflex); Easyflex_data;Easyflex_data[ndate] <= _ContextDate && Easyflex_data[Discontinued]="Yes"); Easyflex_data[RlIdNr] = EARLIER(Easyflex_data[RlIdNr]))

     Many thanks!

    Ronald

  • Vvelarde's avatar
    Vvelarde
    8 years ago

    Anonymous

     

    Try with :

    VAR FilteredTable= FILTER(Easyflex_data;Easyflex_data[ndate] <= _ContextDate && Easyflex_data[Discontinued]="Yes" && EasyFlex_Data[RIIdNr]=EARLIER (EasyFlex_Data[RIIdNr]) ) 

     Regards

     

    Victor