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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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