Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Same day Previous week

tbl_dtbtxclplwp
11/9/20198903455
11/10/2019232142159
11/11/20194455127170
11/12/2019433113133
11/13/2019345615869
11/14/201944510738
11/15/20193366171
11/16/2019876731113
11/17/201976665158125
11/18/2019665101118
11/19/20196778107129
11/20/20195446567971
11/21/2019666445510130
11/22/20195555652137
11/23/20197787729124
11/24/201977878127137
11/25/201955667114135
11/26/20195667100115
11/27/201956889859
11/28/2019889889624
11/29/2019777651183
11/30/2019789843121
12/1/20196777131116
12/2/20196678987110
12/3/2019788873494
12/4/20196774962
12/5/201967768431
12/6/201999456128
12/7/20195544437133
12/8/2019445488107
12/9/20196666689137
12/10/20196676738229
12/11/2019655419767
12/12/201956671283334
12/13/2019665591323
12/14/20195566912334
12/15/201976668855
12/16/20196666105667
12/17/20196677654445
12/18/20197677619556
12/19/201977666128887
12/20/20196677109766
12/21/20195665121877
12/22/2019554410989

 

So I want to show a line graph with it, where the x-axis would be holding the dates and the values on y-axis with two lines. One line will be trending for the current week and the other line should be for any past week selected(I want in a suitation whereby I can select any past week, it can 4weeks back or 2weeks or 3weeks etc and see the trend of what we have for that week as compared to the current week). I don't know if there is a better way you think this could b achieved.

 

Thank you very much.

  • Stachu's avatar
    Stachu
    6 years ago

    Anonymous actually measure used by Mariusz will work for you if you add minus for the day offset (here adjusted for your table)

    Measure = 
    CALCULATE(
        SUM( 'Table'[lwp] ),
        DATEADD( 
            'Table'[tbl_dt], 
            - MAX( 'Week Slicer'[Week No] ) * 7, 
            DAY 
        )
    )


     

7 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi

      Mariusz 

      I can see that you are suming the values.

      I don't want to sum the values, I want in a way whereby I select a day, it will show me the trend values for each day for that week, and also show me the values that we have for those days previous week. 

      • Stachu's avatar
        Stachu
        Icon for Community Champion rankCommunity Champion

        Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

        Column1Column2
        A1
        B2.5