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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
abc_777
Post Prodigy
Post Prodigy

calculate last 3 or 5 or 7 days sales automatically from system day

Hi,

I want to calculate the last 3 or 5 or 7 days' sales automatically from the system date. 

 

 

Date Sale amount
18/11/2021 675
18/11/2021 435
18/11/2021 615
17/11/2021 675
17/11/2021 870
17/11/2021 350
17/11/2021 620
16/11/2021 870
16/11/2021 350
16/11/2021 520
15/11/2021 615
15/11/2021 350
15/11/2021 1150
15/11/2021 575
15/11/2021 490
15/11/2021 655
15/11/2021 880
14/11/2021 1150
14/11/2021 650
14/11/2021 590
14/11/2021 325
14/11/2021 575
14/11/2021 1280
14/11/2021 595
14/11/2021 880
13/11/2021 400
13/11/2021 430
13/11/2021 540
13/11/2021 415
13/11/2021 430
12/11/2021 325
10/11/2021 130
10/11/2021 740
10/11/2021 1150
10/11/2021 290
09/11/2021 790
09/11/2021 915
08/11/2021 1190
08/11/2021 740
08/11/2021 1150
08/11/2021 1150
08/11/2021 1150
08/11/2021 1150
07/11/2021 965
07/11/2021 765
07/11/2021 1150
06/11/2021 830
05/11/2021 590
05/11/2021 575
05/11/2021 1080
05/11/2021 350
05/11/2021 655
05/11/2021 590
05/11/2021 655
04/11/2021 655
04/11/2021 655
04/11/2021 640
04/11/2021 665
04/11/2021 655
04/11/2021 315
03/11/2021 655
03/11/2021 425
03/11/2021 350
02/11/2021 300
02/11/2021 445
02/11/2021 650
02/11/2021 635
02/11/2021 3250
02/11/2021 635
02/11/2021 3250
01/11/2021 870
01/11/2021 575
01/11/2021 655
01/11/2021 940
01/11/2021 350
01/11/2021 1250
01/11/2021 880
31/10/2021 1080
31/10/2021 640
31/10/2021 640
31/10/2021 350
31/10/2021 575
30/10/2021 350
30/10/2021 350
30/10/2021 590
30/10/2021 325
30/10/2021 880
30/10/2021 425
30/10/2021 880
30/10/2021 350
30/10/2021 940
30/10/2021 350
30/10/2021 575
30/10/2021 615
30/10/2021 940
29/10/2021 655
29/10/2021 325
28/10/2021 325
28/10/2021 400
28/10/2021 625
27/10/2021 300
27/10/2021 370
26/10/2021 155
26/10/2021 1600
23/10/2021 550
23/10/2021 1880
23/10/2021 430
23/10/2021 540
23/10/2021 400
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @abc_777 ,

 

You can try a similar measure to the one below:

 

Last 3 days =
VAR selectedDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sale amount] ),
        'Table'[Date] >= selectedDate - 3
            && 'Table'[Date] <= selectedDate
    )

You can adjust this measure to have 3, 5 or 7 days

 

MFelix_1-1637661266107.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @abc_777 ,

 

You can try a similar measure to the one below:

 

Last 3 days =
VAR selectedDate =
    MAX ( 'Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Table'[Sale amount] ),
        'Table'[Date] >= selectedDate - 3
            && 'Table'[Date] <= selectedDate
    )

You can adjust this measure to have 3, 5 or 7 days

 

MFelix_1-1637661266107.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.