cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rodrigosrr Occasional Visitor
Occasional Visitor

Filter sum column by category

I want to create a slicer of categories so that I can see the evolution of the portfolio by period. Any idea how to do it for the example below?

 

PeriodPortfolio (A+B+C)Category ACategory BCategory C
jan-191406490455461
feb-191297485361451
mrt-19941339280322
apr-191030460321249
mei-19915190316409
jun-19569164293112
jul-19929192368369
aug-191429458471500
sep-191155405300450
okt-19778123290365
nov-19951415344192
dec-19886207404275

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthomson New Contributor
New Contributor

Re: Filter sum column by category

Go into Power Query, get rid of the sum column, then unpivot the individual category columns so you have:

 

period - category - value

jan-19 - a - 490

jan-19 - b - 455

jan-19 - c - 461

feb-19 - a - 485

 

etc - the category column can then just be dropped into a slicer as you want

View solution in original post

Community Support Team
Community Support Team

Re: Filter sum column by category

Hi @rodrigosrr ,

 

1. Unpivot the table.

Capture.PNG

 

M code for your reference.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RZC5bgMxDET/ZWsbIEXqYGkgSOEijUvDRRIsgiCHDSPO91sz2k0aSiCfRjM8HieN7f75e9pM6lL64SGoOaMWnU4bMo/zC5gUFf2GqfUpyMF8XX+2Gr0RjrYZ7qlBzFJaZXaXK2TE+EkZU/DJY8jM74uM4g+lG1M6k1hl9jc4zgWgFsf7MNw1/SOfUElEItFvY/1T2d3emJuMZ0y9wkwWWZnDfKHu2Icwt4wNDeb8seSutXFDRje0XfIq83T+hZvMjTGZuS/OFuRhfu2N1hA1CdcsTFa7yukO", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Period = _t, #"Portfolio (A+B+C)" = _t, #"Category A" = _t, #"Category B" = _t, #"Category C" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Period", type text}, {"Portfolio (A+B+C)", Int64.Type}, {"Category A", Int64.Type}, {"Category B", Int64.Type}, {"Category C", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Portfolio (A+B+C)"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"Period"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

 

 

2. Then we can see the evolution of the portfolio by period.

2.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
jthomson New Contributor
New Contributor

Re: Filter sum column by category

Go into Power Query, get rid of the sum column, then unpivot the individual category columns so you have:

 

period - category - value

jan-19 - a - 490

jan-19 - b - 455

jan-19 - c - 461

feb-19 - a - 485

 

etc - the category column can then just be dropped into a slicer as you want

View solution in original post

VNB_VipulSingh Frequent Visitor
Frequent Visitor

Re: Filter sum column by category

As suggested, remove the Portfolio column and unpivot the table on Period, then use the Category column in the slicer.

Community Support Team
Community Support Team

Re: Filter sum column by category

Hi @rodrigosrr ,

 

1. Unpivot the table.

Capture.PNG

 

M code for your reference.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RZC5bgMxDET/ZWsbIEXqYGkgSOEijUvDRRIsgiCHDSPO91sz2k0aSiCfRjM8HieN7f75e9pM6lL64SGoOaMWnU4bMo/zC5gUFf2GqfUpyMF8XX+2Gr0RjrYZ7qlBzFJaZXaXK2TE+EkZU/DJY8jM74uM4g+lG1M6k1hl9jc4zgWgFsf7MNw1/SOfUElEItFvY/1T2d3emJuMZ0y9wkwWWZnDfKHu2Icwt4wNDeb8seSutXFDRje0XfIq83T+hZvMjTGZuS/OFuRhfu2N1hA1CdcsTFa7yukO", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Period = _t, #"Portfolio (A+B+C)" = _t, #"Category A" = _t, #"Category B" = _t, #"Category C" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Period", type text}, {"Portfolio (A+B+C)", Int64.Type}, {"Category A", Int64.Type}, {"Category B", Int64.Type}, {"Category C", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Portfolio (A+B+C)"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"Period"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

 

 

2. Then we can see the evolution of the portfolio by period.

2.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (6,401)