Forum Discussion

baijumohan1990's avatar
4 years ago
Solved

Current Week Vs Previous Week values are not showing correctly.

Hi,   I am creating a dashboard which comparision current week sales vs Last week sales vs Last month Sales based on the date slicer selection using the below table.  5/1/2022 65 5/2/2022 ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi baijumohan1990 ,

     

    If you want to compare the sum of the current week with the sum of the previous week. You can create a WeekNum column to return the week numbers.

    WeekNum = WEEKNUM([Date],2)

    Then create a column to get the sum of previous week.

    PreviousWeekValue = CALCULATE(SUM('Table'[Value]),FILTER('Table',[WeekNum]=EARLIER('Table'[WeekNum])-1))

    Also the current week.

    CurrentWeekValue = CALCULATE(SUM('Table'[Value]),FILTER('Table',[WeekNum]=EARLIER('Table'[WeekNum])))

     

    If you want to compare the current day with the date corresponding to the previous week.

    You can directly filter the date for the day minus 7.

    Column = CALCULATE(SUM('Table'[Value]),FILTER('Table',[Date]=EARLIER('Table'[Date])-7))

     

     

    Best Regards,

    Stephen Tao

     

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