Forum Discussion

mmh's avatar
mmh
Icon for Helper I rankHelper I
3 years ago
Solved

New Customer column

Hi,  I have a table with repeated and new customers, some new customers  having as initialized date as (1800-1-1 til 1-1-3000)   Customer_id valid_from Valid_to 1 1-1-2020 1-2-2021 1 ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi mmh 

    You can try the following code:

    New Customer = var _filter=FILTER('Table',[Customer_id]=EARLIER('Table'[Customer_id]))
    var _indate=MINX(_filter,[valid_from])
    var _end=MAXX(FILTER(_filter,[valid_from]=_indate),[Valid_to])
    return IF([valid_from]>=_indate&&[Valid_to]<=_end,"Yes","No")

    Output

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.