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

Sum by Value in other Column

Hi All, how are you?? I need some help.

 

I've a table with some columns

 

DateOrganizationTypeRazonSocial
01/11/2017 PARTICULAR
01/04/2016CORPORATIVO​​CLEO INFORMACION ESPECIALIZADA SRL
01/04/2017CORPORATIVO​​CLEO INFORMACION ESPECIALIZADA SRL
01/10/2016 PARTICULAR

 

I need to replace OrganizationType with "DIRECT" when RazonSocial have "PARTICULAR". 

 

I tried with Table.ReplaceValue, but i couldn't make it.

1 REPLY 1
Greg_Deckler
Super User
Super User

You could always do something like this:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ3NNQ3MjA0V9JRAqIAx6AQT+dQH8cgpVgdkKwJSNIMKOPsHxTgH+QY4hnmD+Q9augGImcfV38FTz83/yBfR2dPfz8F1+AAV2dPRx/PKEcXR4XgIB9kU8wpNcXQAOYYNJfGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, OrganizationType = _t, RazonSocial = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"OrganizationType", type text}, {"RazonSocial", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [RazonSocial] = "PARTICULAR" then "DIRECT" else [OrganizationType]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"OrganizationType"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "OrganizationType"}})
in
    #"Renamed Columns"

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.