Forum Discussion

alvaro3432's avatar
alvaro3432
New Member
5 years ago
Solved

Calculate week evoluton

Im having troubles calculting weekly evolution of a variable. In my table i have 2 columns:   1) sales 2) weekstart_date (which contains the exact date of the start of the week)   I want to plot...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, alvaro3432 

    Please correct me if I wrongly understand your question.

     

    I created dim-date-table, and in Powe Query Editor, I added week-start-date-column.

    I marked the dim-date-table as a date-table.

    I connected the main fact table and the date table.

    I used the below measures to create the below picture.

    The sample pbix file's link is down below.

     

     

    Previous Week Sales Total =
    VAR currentweekstartdate =
    MAX ( DatesTable[Start of Week] )
    RETURN
    CALCULATE (
    [Sales Total],
    DatesTable[Start of Week] = currentweekstartdate - 7
    )
     
    Other measures are shown in the pbix file.
     
     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.