Forum Discussion

KOCHA's avatar
KOCHA
New Member
2 years ago

measure a label

Hello,

I'm a relatively new user of Power BI. I want to create a measure. For example, all the clients enrolled in the last month (registration date is already a field in my database) are marked as "NEW". How can I do that?

Thanks for your advice.

KOCHA

5 Replies

  • Hi KOCHA 

     

    If you want label a new customer, is better create a New Column in the customers table. If you wanna do that using DAX, you can try the measure bellow.

    If this post helps, please mark as solved. 

    Regards,
    Marcel

    new_customer=
    VAR __current_month = MONTH(TODAY())
    VAR __current_year = YEAR(TODAY())
    RETURN
    IF(
               YEAR(YOUT_TABLE[REGISTRATION_DATE]) = __current_year &&
              ( MONTH(YOUT_TABLE[REGISTRATION_DATE]) = __current_month ||
                  MONTH(YOUT_TABLE[REGISTRATION_DATE]) = __current_month-1)  
    , "NEW CUSTOMER",
                "old customer")