Forum Discussion

Julier's avatar
Julier
Helper III
9 months ago
Solved

column headers as a slicer

Hello, I have my data in power query as below which i have a chart and a table  visual working from this,  i want to be able to slice the table and the chart with a slicer using the column headers, i have tried duplicating my table of data and unpivoting the columns to just have the headers however this will not link to my chart or table visual to work as a slicer, any help would be much appreciated.

HQQPFBDCSFFGMPGMonthSortTarget   
6664618394414930September93000   
6506644481954740October103000   
6144605189744788August83000   
6302624394185671July73000   
          
          
          
  • Julier 

     

    Download this example PBIX file 

     

    So what you are trying to do is only show the columns of data selected in the slicer?

     

    You can use a Field Parameter for this.

     

    From the Modelling menu -> New Parameter -> Fields and add the Fields (columns)

     

     

    make sure the check box 'Add slicer to this page' is checked and click Create

     

    Create a table and add the parameter you just created, use the slicer to display the columns you want

     

     

     

    Regards

     

    Phil

6 Replies

  • Julier 

     

    Download this example PBIX file 

     

    So what you are trying to do is only show the columns of data selected in the slicer?

     

    You can use a Field Parameter for this.

     

    From the Modelling menu -> New Parameter -> Fields and add the Fields (columns)

     

     

    make sure the check box 'Add slicer to this page' is checked and click Create

     

    Create a table and add the parameter you just created, use the slicer to display the columns you want

     

     

     

    Regards

     

    Phil

  • Hallo Julier,

     

    hattest Du Dir das so vorgestellt?

     

    Vor dem Transponieren müssen die Überschriften noch heruntergesetzt werden.

    Der M-Code dazu wäre dieser:

    let
    Quelle = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
    #"Tiefer gestufte Header" = Table.DemoteHeaders(Quelle),
    #"Transponierte Tabelle" = Table.Transpose(#"Tiefer gestufte Header")
    in
    #"Transponierte Tabelle"

  • Julier  Please provide us with a sample file so that I can make some changes and send it over via this thread. 
    You can upload the sample file to a dropbox and share the link over here.

    Thanks,
    Jai

  • ...ich denke, so herum wäre es Dir vielleicht lieber:

     

    Der M-Code hierfür:

    let
    Quelle = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
    OrgTopics = Table.ColumnNames(Quelle),
    TopicDown = Table.DemoteHeaders(Quelle),
    NewTopics = Table.ColumnNames(TopicDown),
    NewNames = List.Zip({NewTopics,OrgTopics}),
    RenameColumns = Table.RenameColumns(TopicDown,NewNames)
    in
    RenameColumns

     

    Oder lieber so?

    ...dann diesen M-Code:

    let
    Quelle = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
    #"Tiefer gestufte Header" = Table.DemoteHeaders(Quelle),
    #"Transponierte Tabelle" = Table.Transpose(#"Tiefer gestufte Header"),
    #"Sortierte Zeilen" = Table.Sort(#"Transponierte Tabelle",{{"Column2", Order.Descending}}),
    #"Höher gestufte Header" = Table.PromoteHeaders(#"Sortierte Zeilen", [PromoteAllScalars=true]),
    #"Umbenannte Spalten" = Table.RenameColumns(#"Höher gestufte Header",{{"Monat", "Attribut"}})
    in
    #"Umbenannte Spalten"