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
mrizvi
Helper I
Helper I

Changing the row entries

I have a column called DEASCH that has a few distinct entries that I need to change. I need to use some sort of "IF C48676 then 3" statement to change all of the following entries. The blanks, empty entries, and the C38046 don't need to be changed to anything.

Do I need to use a measure to do change these rows?

Or should I add a new column to do this? If so, then how would I do it?

 

dea schedule.png

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @mrizvi ,

You can add a custom column in Power Query Editor with the below applied codes, please find the attachment for the details.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcgzydVbSUTKwNACSSrE6aCIKmELOxhYGJmaHFmCRMbEwMzfFIW6GQ9wch7glLpspt5d4GynRO3DhNNAisQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FACILITY = _t, #"FACILITY ID" = _t, DEASCH = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"FACILITY", type text}, {"FACILITY ID", type text}, {"DEASCH", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Trim([DEASCH])<>"" and [DEASCH]<>"C38046" then 3 else [DEASCH])
in
    #"Added Custom"

yingyinr_0-1617697281962.png

Best Regards

Community Support Team _ Rena
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

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @mrizvi ,

You can add a custom column in Power Query Editor with the below applied codes, please find the attachment for the details.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcgzydVbSUTKwNACSSrE6aCIKmELOxhYGJmaHFmCRMbEwMzfFIW6GQ9wch7glLpspt5d4GynRO3DhNNAisQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FACILITY = _t, #"FACILITY ID" = _t, DEASCH = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"FACILITY", type text}, {"FACILITY ID", type text}, {"DEASCH", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Trim([DEASCH])<>"" and [DEASCH]<>"C38046" then 3 else [DEASCH])
in
    #"Added Custom"

yingyinr_0-1617697281962.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

=if(Data[deasch]="C48676" then 3,blank())

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.