Forum Discussion

CarlsBerg999's avatar
CarlsBerg999
Icon for Helper V rankHelper V
6 years ago
Solved

Slicer in columns

Hi,

 

I have an issue with Power Pivot and my current data. The idea is identical as with Power BI, so i posted it here. I have three columns: Sales 2019, Sales 2020 and Sales 2021. I want to sum these and present a pie chart with a drilldown to each of these. 

 

I have no idea how to make a measure / calculated column for these, because the year label is in the column and not in the row. Any ideas?

 

CustomerYear 2019Year 2020Year 2021
Example 110 000€100 000€2 000€
Example 2100 000€5 000€ 
Example 3 200 000€ 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi CarlsBerg999 ,

    According to my understanding, you want to use Pie chart to drill down Sales based on Customer and Year , right?

     

    For my test ,you could follow these steps :

    1.In Query Editor ,Select the Customer column and select ‘unpivot other columns’ in Transform tabs

    2.Ensure the data type of  Value column is Whole Number .The whole applied steps as follows:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcq1IzC3ISVUwVNJRMjTQMTAweNS0BsxG4hjBmLE6CB1G6KpMEUwFFJXGYBGgMciqgUpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Customer = _t, #"Year 2019" = _t, #"Year 2020" = _t, #"Year 2021" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Customer", type text}, {"Year 2019", type text}, {"Year 2020", type text}, {"Year 2021", type text}}),
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Customer"}, "Attribute", "Value"),
        #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "Year"}}),
        #"Replaced Value" = Table.ReplaceValue(#"Renamed Columns","€","",Replacer.ReplaceText,{"Value"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value",{{"Value", Int64.Type}})
    in
        #"Changed Type1"

    3.Create a Pie Chart and drag Year and Customer fields to Legend ,Value(default aggregation is Sum) to Values ,like this:

    Is the result what you want? If you have any questions, please upload some data samples and expected output.

    Please do mask sensitive data before uploading.

     

    Best Regards,

    Eyelyn Qin