Forum Discussion

mesr's avatar
mesr
Frequent Visitor
9 years ago
Solved

Help with table creation/transformation

Hi all,

I'm new to Power BI and am having big trouble calculating a table.

 

I have a csv that has, among others, the following columns:

 

time_stamp, product_name, shop_name, product_price

 

and What I would like to have is something like:

 

time_stamp, product_name, product_price_shop1, product_price_shop2, product_price_shop3, product_price_shop4

 

where the data is shown if and only if the information regarding the price of certain product is available for all shops and for the same day.

 

I'm wondering what the best procedure is. Should I use Power Query, calculate Tables with DAX or should I make this steps first by means of an ETL process? I have tried using PowerQuery but it seems to get really slow when adding several steps... I have also tried using DAX language but I haven't been able to make it work properly.

 

Many thanks in advance,

Esther

  • Hi mesr,

     

    Here are two options you could refer to.

     

    1. Use a Matrix visual to display data. Click the rightest drill down button.

     

    2. Pivot table in Query Edior. Then, use a table visual to hold data.

       

     

    Best regards,
    Yuliana Gu

4 Replies

  • mesr's avatar
    mesr
    Frequent Visitor

    Hi all,

    I'm new to Power BI and am having big trouble calculating a table.

     

    I have a csv that has, among others, the following columns:

     

    time_stamp, product_name, shop_name, product_price

     

    and What I would like to have is something like:

     

    time_stamp, product_name, product_price_shop1, product_price_shop2, product_price_shop3, product_price_shop4

     

    where the data is shown if and only if the information regarding the price of certain product is available for all shops and for the same day.

     

    I'm wondering what the best procedure is. Should I use Power Query, calculate Tables with DAX or should I make this steps first by means of an ETL process? I have tried using PowerQuery but it seems to get really slow when adding several steps... I have also tried using DAX language but I haven't been able to make it work properly.

     

    Many thanks in advance,

    Esther

  • Hi mesr,

     

    Make a column with the following sintax:

    Count_Prices =
    CALCULATE (
        DISTINCTCOUNT ( Table1[Price] ),
        Table1[Product Name] = Table1[Product Name],
        Table1[Timestamp] = Table1[Timestamp]
    )

    Then just add this value to your visual filter and set it to the maximum number of stores In my data I have made 4 stores the final result should look like this:

     

     

    Regards,

    MFelix

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi mesr,

     

    Here are two options you could refer to.

     

    1. Use a Matrix visual to display data. Click the rightest drill down button.

     

    2. Pivot table in Query Edior. Then, use a table visual to hold data.

       

     

    Best regards,
    Yuliana Gu

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi mesr,

     

    Have you get your desired output? If so, would you please kindly mark the helpful reply as an answer or sharing your solution?

     

    Regards,
    Yuliana Gu