Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Pivot tables help

Greetings Community. I'm having problems with pivoting tables.

 

I have a talbe like this

 

 

City name as headers, the following row has the name of the country that city belongs to. I wish to make a table where I can have a column for date, a column for city, a column for country and a column for the values (followers). Like this:

 

 

I'd really appreciate your help on this please.

 

Thanks in advance

  • Hi Anonymous,

     

    For you scenario, I have create a table similar with your farmat.

     

    Assuming that you have a table like below.

    Fecha A1 A2
      country1 country2
    01/01/2018 10  
    01/02/2018 20  
    01/03/2018   10
    01/04/2018 25  
    01/05/2018 25 30

     

    1. Get data and go to Query edit.

     

    2. Duplicate the table and unpviot the columns.

     

    More details you could have a reference of the Applied steps in Query Editor for the attached pbix.

     

    Here is the result.

     

     

    Best Regards,

    Cherry

7 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi Anonymous,

     

    You may could use Unpivot column in Query Editor.

     

    If you still need help, please share some data sample.

     

    Best  Regards,

    Cherry

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello v-piga-msft, thanks for the quick response.

       

      This is a piece my excel fille

       

       

      I wish to make it look like this on Power BI:

       

      I have tried to unpivot that column, but when I do that I get this:

       

       

      So I lose the number value.

       

      Thanks in advance.

      • v-piga-msft's avatar
        v-piga-msft
        Resident Rockstar

        Hi Anonymous,

         

        For you scenario, I have create a table similar with your farmat.

         

        Assuming that you have a table like below.

        Fecha A1 A2
          country1 country2
        01/01/2018 10  
        01/02/2018 20  
        01/03/2018   10
        01/04/2018 25  
        01/05/2018 25 30

         

        1. Get data and go to Query edit.

         

        2. Duplicate the table and unpviot the columns.

         

        More details you could have a reference of the Applied steps in Query Editor for the attached pbix.

         

        Here is the result.

         

         

        Best Regards,

        Cherry