Hello there,
Im trying to plot a sunburst chart in power BI using Plotly.js.
I’m able to generate the plot when the data format looks like this:
But my actual data is looks like this:
and it’s not generating any visual with this data, can you help me set up the plot with the above data set please?
i have updated the 1st dataset. hope that helps understand the request.
zBritva
4
I am not sure about ProductID, is it also Node label or it is Value?
You need apply transforms to your query:
let
Source = sunburst,
RenamedColumns1 = Table.RenameColumns(Source,{{"Category", "Parent"}, {"SubCategory", "Label"}}),
RemovedColumn1 = Table.RemoveColumns(RenamedColumns1,{"SubSubCategory"}),
FakeRootNodes1 = Table.RemoveColumns(RenamedColumns1,{"Label", "SubSubCategory", "ProductID"}),
FakeRootNodes2 = Table.RenameColumns(FakeRootNodes1,{"Parent", "Label"}),
EmptyColumn1 = Table.AddColumn(FakeRootNodes2, "Parent", (x) => ""),
EmptyColumn2 = Table.AddColumn(EmptyColumn1, "ProductID", (x) => 0),
RenamedColumns2 = Table.RenameColumns(Source,{{"SubCategory", "Parent"}, {"SubSubCategory", "Label"}}),
RemovedColumn2 = Table.RemoveColumns(RenamedColumns2,{"Category"}),
//Root = Table.InsertRows(RemovedColumn2, 0, {[Parent="", Label="", ProductID=""]}),
Combination = Table.Combine({RemovedColumn1, RemovedColumn2, EmptyColumn2}),
ChangedType = Table.TransformColumnTypes(Combination,{{"ProductID", Int64.Type}})
in
ChangedType
Result: