Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SJHALANI
Helper I
Helper I

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 6
devanshi
Helper V
Helper V

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

OR

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

tamerj1
Super User
Super User

Hi @SJHALANI 

Please try

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

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

SJHALANI_0-1687764808742.png

 

@SJHALANI 
Ok, please try

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

@tamerj1  No error now, however PO Status lists Active everywhere.

SJHALANI_0-1687771549477.png

 

@SJHALANI 

Please create it as a measure only not as a calculated column. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.