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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
sy898661
Helper V
Helper V

If conditions in 1 column are met, paste value from another column

Lot Disposition Duration 2 = 
    IF('board-Query'[Lot Current Status] = "Approved for Processing", 'board-Query'[Lot Disposition Duration],
    IF('board-Query'[Lot Current Status] = "Approved", 'board-Query'[Lot Disposition Duration],
    IF('board-Query'[Lot Current Status] = "Quarantine", 'board-Query'[Lot Disposition Duration],
    IF('board-Query'[Lot Current Status] = "Reject", 'board-Query'[Lot Disposition Duration],
    IF('board-Query'[Lot Current Status] = "Conditional Release", 'board-Query'[Lot Disposition Duration],
    ""
    )))))

Hi again everyone!

I was wondering if someone could tell me why I can't do this/how to correctly write this. the error message says "Expressions that yield variant data-type cannot be used to define calculated columns."

 

But I feel like I have done something like this before, I just dont know how! The Lot Current Status column has 10 different statuses, but I only want to look at the ones listed above--and if that condition is met, paste the related value from another column (Lot Distribution Duration)

 

Thanks!!!

2 ACCEPTED SOLUTIONS

try this, with IN clause, it makes your code a lot cleaner  and shorter

Lot Disposition Duration 2 =
IF (
'board-Query'[Lot Current Status]
IN {
"Approved for Processing",
"Approved",
"Quarantine",
"Reject",
"Conditional Release"
},
'board-Query'[Lot Disposition Duration],
""
)

View solution in original post

@sy898661 ,

 

You can also modify your measure like below:

Lot Disposition Duration 2 =
IF (
    'board-Query'[Lot Current Status] = "Approved for Processing"
        || 'board-Query'[Lot Current Status] = "Approved"
        || 'board-Query'[Lot Current Status] = "Quarantine"
        || 'board-Query'[Lot Current Status] = "Reject"
        || 'board-Query'[Lot Current Status] = "Conditional Release",
    'board-Query'[Lot Disposition Duration]
)

Community Support Team _ Jimmy Tao

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

View solution in original post

3 REPLIES 3
sy898661
Helper V
Helper V

I tried this but now its just returning true/false, which i guess is one step closer/better than an error! but still not what i want

Lot Disposition Duration 2 = 
    IF('board-Query'[Lot Current Status] = "Approved for Processing", 'board-Query'[Lot Disposition Duration]
    ||
    IF('board-Query'[Lot Current Status] = "Approved", 'board-Query'[Lot Disposition Duration]
    ||
    IF('board-Query'[Lot Current Status] = "Quarantine", 'board-Query'[Lot Disposition Duration]
    ||
    IF('board-Query'[Lot Current Status] = "Reject", 'board-Query'[Lot Disposition Duration]
    ||
    IF('board-Query'[Lot Current Status] = "Conditional Release", 'board-Query'[Lot Disposition Duration],
    ""
    )))))

@sy898661 ,

 

You can also modify your measure like below:

Lot Disposition Duration 2 =
IF (
    'board-Query'[Lot Current Status] = "Approved for Processing"
        || 'board-Query'[Lot Current Status] = "Approved"
        || 'board-Query'[Lot Current Status] = "Quarantine"
        || 'board-Query'[Lot Current Status] = "Reject"
        || 'board-Query'[Lot Current Status] = "Conditional Release",
    'board-Query'[Lot Disposition Duration]
)

Community Support Team _ Jimmy Tao

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

try this, with IN clause, it makes your code a lot cleaner  and shorter

Lot Disposition Duration 2 =
IF (
'board-Query'[Lot Current Status]
IN {
"Approved for Processing",
"Approved",
"Quarantine",
"Reject",
"Conditional Release"
},
'board-Query'[Lot Disposition Duration],
""
)

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.