cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
diegolima
Helper III
Helper III

Calculate column with value of different lines

Hello guys, how are you?

 

I try make a calculate column that showing a value of other column after filter, but I need filter for information of line and put at the cell an information of other line:

 

diegolima_1-1663964650339.png

 

I need to put in the column calculate the information of H0xH1, but I need to filter by Topology Validation, happen that at the line that H0xH1 has information, Validação Topologia don’t has information, I need get a information the under line, but I don’t know how make, somebody can help me.

 

Thank you all.

1 ACCEPTED SOLUTION

Each step in Power Query can reference some other step.  In this case the step is referencing a step called "Source"  which is not present in your code (likely because you use the portuguese word for it).

 

You may want to invest some time in learning Power Query basics.

View solution in original post

9 REPLIES 9
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Hello @lbendlin I will try explaining with clear data:

 

Data 1Data 2 Data 3 Data Results
100 00-25
1 2500-25

 

Data 1- In this cell must contain the information of device identification of my analysis;

Data 2 - In this cell must contain an information of others that I need;

Data 3 - In this cell must contain an information of others that I need;

Data Result - This cell I need make a form that should merge the information of column Data 3 with Data 2;

 

My problem is that in the line that Data 3 have information, Data 2 haven’t, or if Data 2 have information, Data 3 haven’t, how I need merge information of distinct lines I don’t know make this.

 

You can help me? 

Thanks for attention

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIwABIKYIaukalSrA5EGCQC5MKFYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Data 1" = _t, #"Data 2 " = _t, #"Data 3 " = _t, #"Data Results" = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source," ",null,Replacer.ReplaceValue,{"Data 2 ","Data 3 "}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value", "Results", each List.First(List.RemoveNulls(#"Replaced Value"[#"Data 2 "])) & "-" & List.First(List.RemoveNulls(#"Replaced Value"[#"Data 3 "])))
in
    #"Added Custom"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Ok @lbendlin thank for answer, but I need put my data using this code, how I make it?

 

Thanks for all supporting.

replace the Source= step with your own.

Hello @lbendlin  I try but show me a error, I think that I don't make way correct, which step I do cut for put my code?

 

Thanks for supporting!

this part

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIwABIKYIaukalSrA5EGCQC5MKFYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Data 1" = _t, #"Data 2 " = _t, #"Data 3 " = _t, #"Data Results" = _t]),

 

Ok @lbendlin  after step, I see this error:

 

Expression.Error: O nome 'Source' não foi reconhecido. Certifique-se de que ele foi soletrado corretamente.

At the Power Query = Table.ReplaceValue(Source," ",null,Replacer.ReplaceValue,{"Data 2 ","Data 3 "})

 

I do not know what to do.

Each step in Power Query can reference some other step.  In this case the step is referencing a step called "Source"  which is not present in your code (likely because you use the portuguese word for it).

 

You may want to invest some time in learning Power Query basics.

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.