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
Anonymous
Not applicable

create slicer for both column and rows

hi all

i have a data sheet as follow:

 BlankBasicAffiliate StudentVIPVVIP
 Alabama 2014138141
 Alaska 9181114151
 Arizona 17171118160

 

How should i create the slicer for type of membership? Any advice is appreciated. Thank you.

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

I created a sample using two ways. One is creating a new table as a slicer. Another is unpivoting the columns. You could have a try.

  • Create a new table manually

1.PNG

 

Measure = 
VAR a =
    SELECTEDVALUE ( 'Filter Table'[Column] )
RETURN
    SWITCH (
        TRUE (),
        a = "Basic", SUM ( 'Table'[Basic] ),
        a = "Affiliate", SUM ( 'Table'[Affiliate] ),
        a = "Blank", SUM ( 'Table'[Blank] ),
        a = "Student", SUM ( 'Table'[Student] ),
        a = "VIP", SUM ( 'Table'[VIP] ),
        a = "VVIP", SUM ( 'Table'[VVIP] )
    )

 

2.PNG

  • Unpivot columns

3.PNG

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WOrTAMScxKTE38dACJR0lIwMgYWgCIoyBhAWcpxSrA1VbnA1RagkSBiswhKsyRVZalFmVnwdRa2gOJwzh2syAhIFSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [State = _t, Blank = _t, Basic = _t, Affiliate = _t, Student = _t, VIP = _t, VVIP = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Blank", Int64.Type}, {"Basic", Int64.Type}, {"Affiliate", Int64.Type}, {"Student", Int64.Type}, {"VIP", Int64.Type}, {"VVIP", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"State"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

 

 4.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

I created a sample using two ways. One is creating a new table as a slicer. Another is unpivoting the columns. You could have a try.

  • Create a new table manually

1.PNG

 

Measure = 
VAR a =
    SELECTEDVALUE ( 'Filter Table'[Column] )
RETURN
    SWITCH (
        TRUE (),
        a = "Basic", SUM ( 'Table'[Basic] ),
        a = "Affiliate", SUM ( 'Table'[Affiliate] ),
        a = "Blank", SUM ( 'Table'[Blank] ),
        a = "Student", SUM ( 'Table'[Student] ),
        a = "VIP", SUM ( 'Table'[VIP] ),
        a = "VVIP", SUM ( 'Table'[VVIP] )
    )

 

2.PNG

  • Unpivot columns

3.PNG

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WOrTAMScxKTE38dACJR0lIwMgYWgCIoyBhAWcpxSrA1VbnA1RagkSBiswhKsyRVZalFmVnwdRa2gOJwzh2syAhIFSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [State = _t, Blank = _t, Basic = _t, Affiliate = _t, Student = _t, VIP = _t, VVIP = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"State", type text}, {"Blank", Int64.Type}, {"Basic", Int64.Type}, {"Affiliate", Int64.Type}, {"Student", Int64.Type}, {"VIP", Int64.Type}, {"VVIP", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"State"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

 

 4.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Tad17
Solution Sage
Solution Sage

Alternatively, if you don't need the state to be filtered, pivot the data and just create a slicer for membership type.

 

However, you should be able to create slicers for each field since you have it in a matrix format.

 

You will need your data formatted correctly first:

 

State   Membership type   Quantity

Alabama  Blank                     20

Alabama   Basic                     14

 

Etc.

amitchandak
Super User
Super User

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.