Forum Discussion

SJHALANI's avatar
SJHALANI
Helper I
3 years ago

Create measure using DAX

Hi Guys!

I have a column in my table which lists "'PO Year". It could have values 2021, 2022 or 2023. I want to create a new column measure called "PO Status" where if the PO year is 2021 or 2022, PO Status should say "Inactive" otherwise "Active".

PO YearPO Status
2021Inactive
2022Inactive
2023Active


What should be the DAX command to help me achieve this? I am new to DAX commands, so any help is appreciated. Thanks!


6 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi SJHALANI 

    Please try

    PO Status =
    IF (
        SELECTEDVALUE ( 'Table'[PO Year] ) IN { 2021, 2022 },
        "Inactive",
        "Active"
    )
    • SJHALANI's avatar
      SJHALANI
      Helper I

      tamerj1  I am getting the below error. Would you know what this means and how to resolve this?

       

      • tamerj1's avatar
        tamerj1
        Community Champion

        SJHALANI 
        Ok, please try

        PO Status =
        IF (
            SELECTEDVALUE ( 'Table'[PO Year] ) IN { "2021", "2022" },
            "Inactive",
            "Active"
        )
  • IF( OR([PO Year] = 2021 , [PO Year] = 2022 ), "Inactive", "Active")

    OR

    IF([PO Year] = 2021  ||  [PO Year] = 2022 , "Inactive", "Active")