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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.