Forum Discussion
Partial pivoting
paolomint , easy enough
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkjMz8lX0lEK8vd1BVJGBkYGQMotBEgYGhgoxergVWJiik+Jsz+YDVESlpiTWpSZCBQJc/XzdEY3yYKQqmAIWyk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [COMPANY = _t, SHOP = _t, YEAR = _t, COD = _t, VALUE = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index"),
#"Pivoted Column" = Table.Pivot(#"Added Index", List.Distinct(#"Added Index"[COD]), "COD", "VALUE"),
#"Removed Columns" = Table.RemoveColumns(#"Pivoted Column",{"Index"})
in
#"Removed Columns"
Great CNENFRNL , thank you very much
In the easy table I usued as example, It works.
When I try to apply it on my real model, I obtain the following error message:
It is not possible to convert null value on text type:
Detail
Type=[Type]
May I add another line to avoid this error?
thank you very much
- edhans5 years agoCommunity Champion
paolomint - PIVOT has limits. I think this is why it isn't on the right-click menu. It can be finnicky. That said, three questions:
- Why is your value text? Shouln't that be a whole number, not text?
- Why not aggregate the values? So the table below is the result?
- Why are you pivoting in the first place? It depends on the data set, but it could be advantageous in DAX to keep these as they are.
- paolomint5 years agoHelper III
thank you edhans
1. the message error gets out when I try to apply the procedure in my real model
2. yes, I can aggregate
3. About dax, It would be great but I don't know how to do. Can you kindly help me?
thanks in advance
Paolo
- edhans5 years agoCommunity Champion
Provide some good data for us to assist with paolomint as well as expected results. Show us where you want to end up, rather than asking how to do a specific thing. That thing (pivoting) may not be a good way to get to your destination.
How to get good help fast. Help us help you.
How To Ask A Technical Question If you Really Want An Answer
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.