Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CarlsBerg999
Helper V
Helper V

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€ 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@CarlsBerg999 , Not very clear.

You can unpivot the data. And separate out year

https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/

 

Also, you can use more than one column in pie. Do not give legend in that case.

View solution in original post

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

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:

8.26.1.1.jpg

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

pranit828
Community Champion
Community Champion

HI @CarlsBerg999 

 

I would unpivot which will bring year to row and then extract the last four characters to create a new column. RIGHT([Column],4)

Use the below link for unpivot.

https://www.youtube.com/watch?v=9Xv8COs59tc





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
amitchandak
Super User
Super User

@CarlsBerg999 , Not very clear.

You can unpivot the data. And separate out year

https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/

 

Also, you can use more than one column in pie. Do not give legend in that case.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.