I have now thanks to your help almost managed to get the .csv file in my desired format. However, I'm now facing the problem that I can't distinguish between the answers of the different people who answered the survey via pivot conversion, the number of answers can always be different, so dividing by a certain number doesn't get me to the desired format. An example answer1 can look like this:
Answer1
and answer2 like this:
Answer2
Combined it like this:
Combined
If I now try to use pivot column I lose the information of who gave the answer, because the similar Questions gets merged together:
Pivot
Code at this point:
let
Quelle = Folder.Files("Z:\Report Form"),
#"Z:\Report Form\example csv" = Quelle{[#"Folder Path"="Z:\Report Form\",Name="example.csv"]}[Content],
#"Importierte CSV" = Csv.Document(#"Z:\Report Form\example csv",[Delimiter=",", Columns=6, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Höher gestufte Header" = Table.PromoteHeaders(#"Importierte CSV", [PromoteAllScalars=true]),
#"Geänderter Typ" = Table.TransformColumnTypes(#"Höher gestufte Header",{{"id", Int64.Type}, {"userId", type text}, {"voteOptionId", Int64.Type}, {"voteOptionText", type text}, {"voteAnswer", type text}, {"voteOptionType", type text}}),
#"Entfernte Spalten" = Table.RemoveColumns(#"Geänderter Typ",{"userId", "id", "voteOptionId", "voteOptionType"}),
#"Gruppierte Zeilen" = Table.Group(#"Entfernte Spalten", {"voteOptionText"}, {{"Anzahl", each _, type table [voteOptionText=nullable text, voteAnswer=nullable text]}}),
#"Hinzugefügte benutzerdefinierte Spalte" = Table.AddColumn(#"Gruppierte Zeilen", "Custom", each Table.AddIndexColumn([Anzahl], "index", 1)),
#"Erweiterte Custom" = Table.ExpandTableColumn(#"Hinzugefügte benutzerdefinierte Spalte", "Custom", {"voteAnswer", "index"}, {"voteAnswer", "index"}),
#"Entfernte Spalten1" = Table.RemoveColumns(#"Erweiterte Custom",{"Anzahl"}),
#"Pivotierte Spalte" = Table.Pivot(#"Entfernte Spalten1", List.Distinct(#"Entfernte Spalten1"[voteOptionText]), "voteOptionText", "voteAnswer")
in
#"Pivotierte Spalte"
So what I tried to do was to merge the answers from same questions together, but I can't distinguish between the 2 diffrent persons who gave the answers. I also tried to implement a counter, which increases everytime QuestionA appears, since this question has only 1 answer possibility, but I also failed here. Do you have any further advices? I hope I was able to describe my problem understandable.
Index
column; and then anInteger/Divide
column to create a column by which you can group the different responders. Then it's just a matter of splitting out the desired columns in theTable.Group
operations. – Ron Rosenfeld