Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
In PowerBI i have a data Table 1, which needs to be converted a in Table 2.
Is it possible? Thanks in advance for your help.
Table 1:Table 1 (from)
Table 2:Table 2 (to)
BR,
Anabn
Solved! Go to Solution.
Hi,
let
Source = Your_Source,
Unpivot = Table.UnpivotOtherColumns(Source, {"ID", "Activity"}, "Attribute", "Value"),
Combine_Columns = Table.CombineColumns(Unpivot,{"Activity", "Attribute"},Combiner.CombineTextByDelimiter("_", QuoteStyle.None),"Attribute.1"),
Pivot = Table.Pivot(Combine_Columns, List.Distinct(Combine_Columns[Attribute.1]), "Attribute.1", "Value",
each Text.Combine(List.Transform(_, Text.From), " - "))
in
Pivot
Stéphane
Hi,
let
Source = Your_Source,
Unpivot = Table.UnpivotOtherColumns(Source, {"ID", "Activity"}, "Attribute", "Value"),
Combine_Columns = Table.CombineColumns(Unpivot,{"Activity", "Attribute"},Combiner.CombineTextByDelimiter("_", QuoteStyle.None),"Attribute.1"),
Pivot = Table.Pivot(Combine_Columns, List.Distinct(Combine_Columns[Attribute.1]), "Attribute.1", "Value",
each Text.Combine(List.Transform(_, Text.From), " - "))
in
Pivot
Stéphane
=Table.Combine(Table.Group(PreviousStepName,"ID",{"n",each let a=List.Skip(Table.ColumnNames(_),2) in #table({"ID"}&List.TransformMany([Activity],each a,(x,y)=>x&"_"&y),{List.Combine(Table.Rows(Table.SelectColumns(_,a)))})})[n])
Hi,
let
Source = Your_Source,
Unpivot = Table.UnpivotOtherColumns(Source, {"ID", "Activity"}, "Attribute", "Value"),
Combine_Columns = Table.CombineColumns(Unpivot,{"Activity", "Attribute"},Combiner.CombineTextByDelimiter("_", QuoteStyle.None),"Attribute.1"),
Pivot = Table.Pivot(Combine_Columns, List.Distinct(Combine_Columns[Attribute.1]), "Attribute.1", "Value")
in
Pivot
Stéphane
Hi, Thank you 🙂
this worked perfectly fine.
But some values have Error after Pivot, even though it had a proper date format before pivot.Error
You could do it by first unpivoting the Date 1, Date 2, and Date 3 columns, create a new column that merges the first column with the new Attribute column (Date 1/2/3), and then pivoting on that new column. However, you should consider just doing the unpivot step only to set your data up for easier analysis (you could always create your design table in a visual as needed).
Pat
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |