Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

sales analysis

Hello I have a following Power BI query to solve.

 

Tasks:

    • 1. Data Import and Transformation: o Import the data into Power BI.
    • o Create a relationship between the Region and Product tables.
    • o Pivot the data to create a table with columns: Date, Region, Product, and SalesAmount.
    •  
    • 2. DAX Formulas: o Create a calculated column that calculates the year-to-date (YTD) sales.
    • o Calculate the total sales for each region using DAX measures.
    • o Calculate the top-selling product for each region

      Can someone help ? I am new to power bi
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

    I don't think it's necessary if there's no clear need for it. Pivoting affects the creation of visuals.

    You just need to make sure the data is arranged in this way.

     

    Best Regards,
    Wenbin Zhou

  • Anonymous's avatar
    Anonymous
    2 years ago

    Ok that great. I got it now. Thanks Wenbin!

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    • ModellingData
    •  
    •  
    • data

     

     

    I have done some data cleaning and  modelling from my end . Don't know if its correct or not.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    1.Regarding your question, you should have completed this part of the task.

    2.

    You can do pivot and unpivot here.

    3.

    You can create similar DAX expressions using the 'TOTALYTD' function.

    TOTALYTD function (DAX) - DAX | Microsoft Learn

    Column = TOTALYTD(SUM('Table'[Amount]),'Table'[Date].[Date],ALLEXCEPT('Table','Table'[Region]))

     

    4.

    Use the following DAX expression to create a measure.

    Measure = SUM('Table'[Amount])

    5.

    The Table data is shown below:

    Use the following DAX expression to create a measure

    Measure = 
    CONCATENATEX(FILTER('Table','Table'[Amount] = MAX('Table'[Amount])),[Product],",")

    CONCATENATEX function (DAX) - DAX | Microsoft Learn

     

    Best Regards,
    Wenbin Zhou
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi

      Thanks for your reply.

      Regarding unpivot and pivot I know how to do it. But I don't understand what to pivot .

       

      Also I don't understand the reason behind doing unpivot and pivot in this data. Is it necessary here ?Could you please explain?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

        As I understand it, pivot just lets you look at the data from another angle.

        If you perform a pivot operation in Power query, it is not conducive to building visuals in Power BI Desktop, so perform an unpivot operation.

        You don't seem to have performed a pivot operation in your step, and a unpivot operation seems to be unnecessary.

         

        Best Regards,
        Wenbin Zhou