Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi all,
I need to explode the values as column headers. For example, I have this situation:
| tabella | campo | risultato | pilastro | indicatore |
| x | x | 1 | adeguatezza | data quality |
| x | x | 0,5 | copertura | data quality |
| x | y | 1 | adeguatezza | data dictionary |
| z | z | 1 | adeguatezza | business glossary |
| z | z | 1 | copertura | business glossary |
| z | z | 1 | copertura | data quality |
This is what I want in Power Bi:
| tabella | campo | data quality | data dictionary | business glossary | adeguatezza | copertura |
| x | x | 0,75 | 1 | 0,5 | ||
| x | y | 1 | 1 | |||
| z | z | 1 | 1 | 1 | 1 |
Can anyone help me to solve the problem?
Thanks
Solved! Go to Solution.
Hi @mzedda ,
I would split this table up into 2, then append befor pivoting with an average aggregation:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqlDSAWNDIE5MSU0vTSxJrapKBPJSEksSFQpLE3MySyqVYnUQSg10TIFkcn5BalFJaRFOpZW4TU3JTC7JzM9LLIKorgKKV2FVnVRanJmXWlyskJ6TX1yMTT2yM0hTjeroWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [tabella = _t, campo = _t, risultato = _t, pilastro = _t, indicatore = _t]),
_staging = Table.TransformColumnTypes(Source,{{"tabella", type text}, {"campo", type text}, {"risultato", type number}, {"pilastro", type text}, {"indicatore", type text}}, "de-DE"),
#"Removed Columns" = Table.RemoveColumns(_staging,{"pilastro"}),
_tbl1 = Table.RenameColumns(#"Removed Columns",{{"indicatore", "Header"}}),
Custom1 = _staging,
#"Removed Columns1" = Table.RemoveColumns(Custom1,{"indicatore"}),
_tbl2 = Table.RenameColumns(#"Removed Columns1",{{"pilastro", "Header"}}),
Custom2 = _tbl2 & _tbl1,
#"Pivoted Column" = Table.Pivot(Custom2, List.Distinct(Custom2[Header]), "Header", "risultato", List.Average)
in
#"Pivoted Column"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @mzedda ,
I would split this table up into 2, then append befor pivoting with an average aggregation:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqlDSAWNDIE5MSU0vTSxJrapKBPJSEksSFQpLE3MySyqVYnUQSg10TIFkcn5BalFJaRFOpZW4TU3JTC7JzM9LLIKorgKKV2FVnVRanJmXWlyskJ6TX1yMTT2yM0hTjeroWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [tabella = _t, campo = _t, risultato = _t, pilastro = _t, indicatore = _t]),
_staging = Table.TransformColumnTypes(Source,{{"tabella", type text}, {"campo", type text}, {"risultato", type number}, {"pilastro", type text}, {"indicatore", type text}}, "de-DE"),
#"Removed Columns" = Table.RemoveColumns(_staging,{"pilastro"}),
_tbl1 = Table.RenameColumns(#"Removed Columns",{{"indicatore", "Header"}}),
Custom1 = _staging,
#"Removed Columns1" = Table.RemoveColumns(Custom1,{"indicatore"}),
_tbl2 = Table.RenameColumns(#"Removed Columns1",{{"pilastro", "Header"}}),
Custom2 = _tbl2 & _tbl1,
#"Pivoted Column" = Table.Pivot(Custom2, List.Distinct(Custom2[Header]), "Header", "risultato", List.Average)
in
#"Pivoted Column"
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
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 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 7 | |
| 5 | |
| 5 |