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
Pri
Frequent Visitor

Creating slicer when data is in different columns

I have data in three different columns and I want to create a slicer with this data.

 

Please suggest a way to do the same.

1 ACCEPTED SOLUTION

Hi @Pri ,

 

Go to power query as the picture as below.

pq.PNG

 

Then choose all the columns and upivot columns as the picture below.

 

unp.PNG

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

6 REPLIES 6
mussaenda
Super User
Super User

Provide sample data and expected output.

Pri
Frequent Visitor

Sample Data :

 

Total ValueInternal ValueExternal Value
1004060
703040

 

Expected Output:

 

Slicer with three options in dropdown : Total Value, Internal Value, External Value

Based on your provided data, try this:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwUNJRMgERZgZKsTrRSuYgtjFUNDYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Total Value" = _t, #"Internal Value" = _t, #"External Value" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Total Value", Int64.Type}, {"Internal Value", Int64.Type}, {"External Value", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value")
in
    #"Unpivoted Columns"

2019_09_01_11_02_13_Untitled_Power_BI_Desktop.png

Pri
Frequent Visitor

 

Where do I need to paste this code? 

Hi @Pri ,

 

Go to power query as the picture as below.

pq.PNG

 

Then choose all the columns and upivot columns as the picture below.

 

unp.PNG

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

In power Query, Advance Editor.

Delete everything from there and paste the code.

 

This is based on the data you provided.

Follow the applied steps on your own data to achieve what you needed.

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.