Forum Discussion
Need to add columns to table visual based on slicer selection
- 5 years ago
Hi Anonymous ,
If cannot using unpivot feature due to the size of your data source, you can extract the column name as a new table like this(supposing there has been a column that you must show it in the visual, otherwise it could not be supported currently unless usng unpivot)
In my sample, supposing the index column must be shown in the visual, the query could be like this:
let Source = Table.ColumnNames(#"Table"), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Column Name"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Column Name", type text}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Column Name] <> "Index")) in #"Filtered Rows"Create a measure like this:
A = SWITCH ( SELECTEDVALUE ( 'Column Name'[Column Name] ), "Column1", MAX ( 'Table'[Column1] ), "Column2", MAX ( 'Table'[Column2] ), "Column3", MAX ( 'Table'[Column3] ), "Column4", MAX ( 'Table'[Column4] ), "Column5", MAX ( 'Table'[Column5] ), "Column6", SUM ( 'Table'[Column6] ), "Column7", SUM ( 'Table'[Column7] ), "Column8", SUM ( 'Table'[Column8] ), "Column9", SUM ( 'Table'[Column9] ), "Column10", SUM ( 'Table'[Column10] ) )Use a Matrix visual not a table visual to show the result:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply !
I have 50+ such columns which needs to be added in the slicer, so bookmarks will be very tedious 🙂
Maybe this post will help you:
- Anonymous5 years agoNot applicable
For the above link, they have very less data but for me its HUGE so Unpivot is not possible 🙂 I saw this link long back only
- Anonymous5 years agoNot applicable
got it. Let me have a look