Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Same day Previous week

IMG_20200114_062759_0.jpg

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.

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

@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 
    )
)


Capture.PNG

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

7 REPLIES 7
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Please see the attached file with a solution.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

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
Community Champion
Community 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

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

@Stachu  I have added some annoymized data.

 

So all I want to do is same day previous weeks.

 

As I stated earlier

Stachu
Community Champion
Community Champion

the days in the X axis are always showing just current week, correct? So looking at the report today (22-01-2020), with 3 weeks reference, the chart would be following:

X axis - dates from 16-01-2020 till 22-01-2020

Current week - values for dates 16-01-2020 till 22-01-2020

PreviousWeek - value for 26-12-2019  shown in 16-01-2020 x axis, 27-12-2019  shown in 17-01-2020 x-axis, etc

do I understand it correctly?



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

@Stachu 

X-axis will show the current week with the line trend, that is 17/01/2020 to 23/01/2020, while the other line trend hovering over will show previous week like from 10/01/2020 to 16/01/2020(although this can be for last week, last 2weeks i.e 03/01/2020 to 09/01/2020) etc.

 

Hope I am clear enough.

 

Thanks for your input thus far.

Stachu
Community Champion
Community Champion

@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 
    )
)


Capture.PNG

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.