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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Create new column with specific data from a different column

Hi everyone

 

I have a a table where i need a new column made based on info on one of the other columns.

 

The table looks like this 

Order No.TypeDescription
1A(blank)
1B(blank)
1CNext week delivery
2A(blank)
2BCheck bounced
2C

Return to sender

 

I want to create a new column that duplicates the Description of a Order No. where the Type is C to the rest of the rows of that Order. So in the end it should look like this:

Order No.TypeDescriptionNew column
1A(blank)Next week delivery
1B(blank)Next week delivery
1CNext week deliveryNext week delivery
2A(blank)Return to sender
2BCheck bouncedReturn to sender
2CReturn to senderReturn to sender

 

I achieved this already with a simple LOOKUPVALUE measure:

 

LOOKUPVALUE(Table[Description], Table[Type], "C", Table[Order No.], SELECTEDVALUE(Table[Order No.]))

 

But the calculation is too heavy for the amount of rows i have. That's why i want it done as a calculated column so the heavy lifting is done when the user opens the report.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try new column

New column =
var _ord = [Order No]
var _type = "C"
return
if(isblank([Description]), maxx(filter(Table, [Order No] =_ord && [Type] ="C"),[Description]) ,[Description])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try new column

New column =
var _ord = [Order No]
var _type = "C"
return
if(isblank([Description]), maxx(filter(Table, [Order No] =_ord && [Type] ="C"),[Description]) ,[Description])

Anonymous
Not applicable

Thank you for the swift answer @amitchandak 

 

There was a little misunderstanding in how i wanted the column. Your calculation first checked for a description and then found the one with type "C" if the current Description was blank. I needed all to be from their respective type "C", so i altered your calculation and removed the IF sentence along with isblank.

Like this:

New column =
var _ord = [Order No]
var _type = "C"
return
maxx(filter(Table, [Order No] = _ord && [Type] = _type),[Description])

That did the trick and now it works like a charm. Thank you for the help.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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