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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
lutre
New Member

Transform Table and Filtering [Beginner]

Hey,

 

I´m new to Power BI so sorry for this basic question.

 

"VarName";"TimeString";"VarValue";"Validity";"Time_ms"
"Auftrag";"15.05.2018 09:56:25";0;1;43235414182,9977
"Auftrag h";"15.05.2018 09:56:25";0;1;43235414183,0093
"Aus";"15.05.2018 09:56:25";0;1;43235414183,0093
"Aus h";"15.05.2018 09:56:25";0;1;43235414183,0093
"Dauerlauf";"15.05.2018 09:56:25";0;1;43235414183,0093
"Dauerlauf h";"15.05.2018 09:56:25";0;1;43235414183,0093
"Handbetrib";"15.05.2018 09:56:25";0;1;43235414183,0093
"Handbetrieb h";"15.05.2018 09:56:25";0;1;43235414183,0093
"S 2";"15.05.2018 09:56:25";0;1;43235414183,0208
"S 2 h";"15.05.2018 09:56:25";0;1;43235414183,0208
"S 40";"15.05.2018 09:56:25";0;1;43235414183,0208
"S 40 h";"15.05.2018 09:56:25";0;1;43235414183,0208
"Auftrag";"15.05.2018 09:59:52";7273;1;43235416575,9491
"Auftrag h";"15.05.2018 09:59:52";1552;1;43235416575,9491
"Aus";"15.05.2018 09:59:52";0;1;43235416575,9491
"Aus h";"15.05.2018 09:59:52";0;1;43235416575,9491
"Dauerlauf";"15.05.2018 09:59:52";36000;1;43235416575,9491
"Dauerlauf h";"15.05.2018 09:59:52";3600;1;43235416575,9606
"Handbetrib";"15.05.2018 09:59:52";0;1;43235416575,9606
"Handbetrieb h";"15.05.2018 09:59:52";0;1;43235416575,9606
"S 2";"15.05.2018 09:59:52";29296;1;43235416575,9606
"S 2 h";"15.05.2018 09:59:52";2196;1;43235416575,9606
"S 40";"15.05.2018 09:59:52";0;1;43235416575,9606
"S 40 h";"15.05.2018 09:59:52";42;1;43235416575,9606
"Auftrag";"15.05.2018 10:59:52";8172;1;43235458234,9884
"Auftrag h";"15.05.2018 10:59:52";899;1;43235458234,9884
"Aus";"15.05.2018 10:59:52";0;1;43235458234,9884
"Aus h";"15.05.2018 10:59:52";0;1;43235458234,9884
"Dauerlauf";"15.05.2018 10:59:52";39600;1;43235458235
"Dauerlauf h";"15.05.2018 10:59:52";3600;1;43235458235
"Handbetrib";"15.05.2018 10:59:52";0;1;43235458235
"Handbetrieb h";"15.05.2018 10:59:52";0;1;43235458235
"S 2";"15.05.2018 10:59:52";32068;1;43235458235
"S 2 h";"15.05.2018 10:59:52";2803;1;43235458235
"S 40";"15.05.2018 10:59:52";0;1;43235458235
"S 40 h";"15.05.2018 10:59:52";31;1;43235458235

 

The collum "VarName" is showing the actual name of the variable. The collum "TimeString" is showing the timestamp when the variable was logged. "VarValue" shows the actual value of the variable.

 

Now i want to do calculations like divide the"VarValue" where "VarName" = "Auftrag" through the "VarValue" where "VarName" = "Dauerlauf".  I want to map the result of the calculation over time with the corresponding "TimeString" form the original values.

 

I sadly have no idea how to do this.

 

Is there a way to transform the data in the following form?

 

"TimeString";"Auftrag";"Auftrag h";"Aus";"Aus h";"Dauerlauf";"Dauerlauf h";"Handbetrib";"Handbetrieb h";"S 2";"S 2 h";"S 40";"S 40 h"
"15.05.2018 09:56:25";0;0;0;0;0;0;0;0;0;0;0;0
"15.05.2018 09:56:52";7273;1552;0;0;36000;3600;0;0;29296;2196;0;42
"15.05.2018 10:56:52";8172;899;0;0;39600;3600;0;0;32068;2803;0;31

(I dont want to export the  table, i just want to work with it in power bi in that form).

I think the calculations would be way easier if i had the data in that form.

 

Regards,

 

Luis

 

2 REPLIES 2
Anonymous
Not applicable

Hi @lutre,

you can Pivot your VarName column in Query Editor, and select VarValue as your values column

let
    Source = Csv.Document(File.Contents("C:\Downloads\Data.csv"),[Delimiter=";", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"VarName", type text}, {"TimeString", type text}, {"VarValue", Int64.Type}, {"Validity", Int64.Type}, {"Time_ms", type number}}),
    #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[VarName]), "VarName", "VarValue", List.Sum)
in
    #"Pivoted Column"
lutre
New Member

Hey,

 

I´m new to PowerBI so im sorry for this very basic Question.

 

I´m getting the Data in the following form:

 

"VarName";"TimeString";"VarValue";"Validity";"Time_ms"
"Auftrag";"15.05.2018 09:56:25";0;1;43235414182,9977
"Auftrag h";"15.05.2018 09:56:25";0;1;43235414183,0093
"Aus";"15.05.2018 09:56:25";0;1;43235414183,0093
"Aus h";"15.05.2018 09:56:25";0;1;43235414183,0093
"Dauerlauf";"15.05.2018 09:56:25";0;1;43235414183,0093
"Dauerlauf h";"15.05.2018 09:56:25";0;1;43235414183,0093
"Handbetrib";"15.05.2018 09:56:25";0;1;43235414183,0093
"Handbetrieb h";"15.05.2018 09:56:25";0;1;43235414183,0093
"S 2";"15.05.2018 09:56:25";0;1;43235414183,0208
"S 2 h";"15.05.2018 09:56:25";0;1;43235414183,0208
"S 40";"15.05.2018 09:56:25";0;1;43235414183,0208
"S 40 h";"15.05.2018 09:56:25";0;1;43235414183,0208
"Auftrag";"15.05.2018 09:59:52";7273;1;43235416575,9491
"Auftrag h";"15.05.2018 09:59:52";1552;1;43235416575,9491
"Aus";"15.05.2018 09:59:52";0;1;43235416575,9491
"Aus h";"15.05.2018 09:59:52";0;1;43235416575,9491
"Dauerlauf";"15.05.2018 09:59:52";36000;1;43235416575,9491
"Dauerlauf h";"15.05.2018 09:59:52";3600;1;43235416575,9606
"Handbetrib";"15.05.2018 09:59:52";0;1;43235416575,9606
"Handbetrieb h";"15.05.2018 09:59:52";0;1;43235416575,9606
"S 2";"15.05.2018 09:59:52";29296;1;43235416575,9606
"S 2 h";"15.05.2018 09:59:52";2196;1;43235416575,9606
"S 40";"15.05.2018 09:59:52";0;1;43235416575,9606
"S 40 h";"15.05.2018 09:59:52";42;1;43235416575,9606
"Auftrag";"15.05.2018 10:59:52";8172;1;43235458234,9884
"Auftrag h";"15.05.2018 10:59:52";899;1;43235458234,9884
"Aus";"15.05.2018 10:59:52";0;1;43235458234,9884
"Aus h";"15.05.2018 10:59:52";0;1;43235458234,9884
"Dauerlauf";"15.05.2018 10:59:52";39600;1;43235458235
"Dauerlauf h";"15.05.2018 10:59:52";3600;1;43235458235
"Handbetrib";"15.05.2018 10:59:52";0;1;43235458235
"Handbetrieb h";"15.05.2018 10:59:52";0;1;43235458235
"S 2";"15.05.2018 10:59:52";32068;1;43235458235
"S 2 h";"15.05.2018 10:59:52";2803;1;43235458235
"S 40";"15.05.2018 10:59:52";0;1;43235458235
"S 40 h";"15.05.2018 10:59:52";31;1;43235458235
"Auftrag";"15.05.2018 11:59:52";9064;1;43235499902,4306
"Auftrag h";"15.05.2018 11:59:52";892;1;43235499902,4306
"Aus";"15.05.2018 11:59:52";0;1;43235499902,4306
"Aus h";"15.05.2018 11:59:52";0;1;43235499902,4306
"Dauerlauf";"15.05.2018 11:59:52";43200;1;43235499902,4306
"Dauerlauf h";"15.05.2018 11:59:52";3600;1;43235499902,4421
"Handbetrib";"15.05.2018 11:59:52";0;1;43235499902,4421
"Handbetrieb h";"15.05.2018 11:59:52";0;1;43235499902,4421
"S 2";"15.05.2018 11:59:52";34838;1;43235499902,4421
"S 2 h";"15.05.2018 11:59:52";2796;1;43235499902,4421
"S 40";"15.05.2018 11:59:52";0;1;43235499902,4421
"S 40 h";"15.05.2018 11:59:52";26;1;43235499902,4421

The first collumn lists the name of the variable thats logged. The second collumn is showing the timestamp when the value was logged. The third collumn is shows the actual value of the variable.

 

Now i want to do calculations like divide the "VarValue" of all variables with the "VarName" = "S 40" through all the "VarValue" of all Variables with the "VarName" = "S 40".

 

I honestly have no idea how to do this.

 

Is there a way to automatically transform the table in a form like this:

 

 

"TimeString";"Auftrag";"Auftrag h";"Aus";"Aus h";"Dauerlauf";"Dauerlauf h";"Handbetrib";"Handbetrieb h";"S 2";"S 2 h";"S 40";"S 40 h"
"15.05.2018 09:56:25";0;0;0;0;0;0;0;0;0;0;0;0
"15.05.2018 10:56:52";7273;1552;0;0;36000;3600;0;0;29296;2196;0;42
"15.05.2018 11:56:52";8172;899;0;0;39600;3600;0;0;32068;2803;0;31

(i dont want to export it in that way, i just want to work with the table in that form in power bi).

 

Regards,

 

Luis

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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