Forum Discussion

Bhoobala_P's avatar
Bhoobala_P
Frequent Visitor
9 years ago

Use Column Name as Filter

Guys,

 

I have a dataset like this:

Customer IDonsite/offshoreRegion01-01-201101-02-201101-03-201101-04-2011
Customer1onsite   Kuwait200000200000200000300000
Customer2offshoreUK200000200000200000300000
Customer3onsite   USA210000210000210000210000
Customer4offshoreUSA220000220000220000220000
Customer5offshoreUSA210000210000210000230000
Customer6offshoreDenmark220000220000220000240000
Customer7onsite   Australia230000230000230000250000

 

I want to create a chart for the data, with time filter (viz., the column name).

Problems I face are:

1. When I load this data into Power BI, it will not load date as a column name!! Instead it gives default column names (Column4, Column5, Column6, etc). How to load date as column name??

 

2. Assuming I can upload data with dates as column names, I make a duplicate of the table. If I use unpivot data by selecting the date columns alone (i.e., column 4 to 7) from the duplicate. I will get Attribute column which contains unique value of dates:

Attribute
01-01-2011
01-02-2011
01-03-2011
01-04-2011

However, if I try to use this attribute column as a filter, it doesn't work!! How can I establish relationship between data in the original table and the attribute column of duplicate table?

 

P.S. Is there any other way to sort out this issue??? Pls help!

10 Replies

  • Sean's avatar
    Sean
    Community Champion

    Bhoobala_P  No need to Duplicate the table

    In the Query Editor

    1) Transform tab => Use First Row as Headers (if necessary)

    2) select Customer ID, onsite/offshore and Region Columns => Unpivot Other Columns
    3) Rename New Columns (if necessary) Attribute to Date

    4) Close and Apply

     

    Here's the result...

     

     

    And...

     

     

    Hope this helps.

    Good Luck! :smileyhappy:

    • Bhoobala_P's avatar
      Bhoobala_P
      Frequent Visitor

      Dear Sean,

       

      Thanks, that really helped me. However in the first step, i.e., when I load the data and selected 'Use First Row as Header', it still converts the date value into default text(Column5, Column6, etc).

       

      Is there an option to make the date appear as column name as such, when I select 'Use First Row as Header'??

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Bhoobala_P,

        When you select 'Use First Row as Header', it is impossible to make the date column heading as date type, we are only able to change type for values in one column.

        After you Unpivot columns, you are able to change the type of date value in Attribute column to Date type(select the whole Attribute column and right click on it, you will get the following screenshot).

         


        Thanks,
        Lydia Zhang

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello,

       

      because of this solution data size will increase let's say we have 1 billion records if we unpivot it then it will convert in 4 Billion. This is not feasible. Actually, I am also facing this issue. Can you suggest me a better solution?

       

      Thanks in advance