Forum Discussion

Upali63's avatar
Upali63
Helper II
3 years ago
Solved

Extract Weekly Sales volume from Daily transaction table

Hi Friends

I am new to power BI

I have two table as shown below. One for the weekly data and otherone for daily transactions. What I want is to make report in my power bi dash board to show weekly information with last column in my report to be based on data from the daily transation table. In that I want price multified by qty to be shown as Turnover in my weekly report. Kindly help me to solve my issue. Thank you

 

 

  • Hi Upali63 ,

     

    --1--

    In Power Query, select your Daily Table query and go to the Add Column tab > Custom Column. Call it 'Turnover' and use the following calculation:

    [Price] * [Qty]

     

    --2--

    Then create a calendar table in Power Query (many examples online) with a [WeekEndingDate] column. In PQ, you would create it like this:

    Date.EndOfWeek([Date], Day.Friday)

    Adjusting the 'Day.Friday' argument to the desired first day of the week.

     

    --3--

    Apply all to the data model and relate:

    Calendar[Date] to WeeklyTable[W-End]

    Calendar[Date] to DailyTable[Date]

     

    --4--

    Create a measure for your Turnover value:

    _turnover = SUM(DailyTable[Turnover])

     

    --5--

    In a table visual, add these fields:

    Calendar[WeekEndingDate]

    WeeklyTable[All columns except [W-End] ]

    ...and add this measure:

    [_turnover]

     

    This should do what you want.

     

    Pete

2 Replies

  • Hi Upali63 ,

     

    --1--

    In Power Query, select your Daily Table query and go to the Add Column tab > Custom Column. Call it 'Turnover' and use the following calculation:

    [Price] * [Qty]

     

    --2--

    Then create a calendar table in Power Query (many examples online) with a [WeekEndingDate] column. In PQ, you would create it like this:

    Date.EndOfWeek([Date], Day.Friday)

    Adjusting the 'Day.Friday' argument to the desired first day of the week.

     

    --3--

    Apply all to the data model and relate:

    Calendar[Date] to WeeklyTable[W-End]

    Calendar[Date] to DailyTable[Date]

     

    --4--

    Create a measure for your Turnover value:

    _turnover = SUM(DailyTable[Turnover])

     

    --5--

    In a table visual, add these fields:

    Calendar[WeekEndingDate]

    WeeklyTable[All columns except [W-End] ]

    ...and add this measure:

    [_turnover]

     

    This should do what you want.

     

    Pete