Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Column selection based on dropdown

have a database where the first column contains historic dates. The remaining columns all contain historic data. Each columnheader has the following structure country+number

For example us2, us5, us10, uk2, uk5, uk10

In this example there are 2 options for countries and 3 for the number. These option data is also in a table. So i can make a dropdown containing us and uk and a dropdown with 2 5 10.

 

Lets say i now select us and 5. How can i make a graph plotting the data in the column us5.

  •  

    Go to Power Query:

    • Transform Data in Power Query

      • Select all country-number columns (us2, us5, etc.).
      • Click Transform > Unpivot Columns.
      • Rename new columns to CountryNumber and Value.
      • Split CountryNumber into Country and Number.
    • Use Simple Filtering

      • Create slicers for Country and Number.
      • Use Value in the graph, filtering based on the slicers.

     

3 Replies

  • Uzi2019's avatar
    Uzi2019
    Community Champion

    Hi Anonymous 

    Can you share the sample data and expected output???

     

  •  

    Go to Power Query:

    • Transform Data in Power Query

      • Select all country-number columns (us2, us5, etc.).
      • Click Transform > Unpivot Columns.
      • Rename new columns to CountryNumber and Value.
      • Split CountryNumber into Country and Number.
    • Use Simple Filtering

      • Create slicers for Country and Number.
      • Use Value in the graph, filtering based on the slicers.