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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cottrera
Post Prodigy
Post Prodigy

Count previous 7 days

Hi 

I have a table called Poperty and with a column called buld date. I need DAX to count the number of dates for the previous 7 days .

FOr the example table below I would expect the resulting count to = 7

 

Table_Property
 
Date Built
18/11/2019
17/11/2019
17/11/2019
14/11/2019
14/11/2019
14/11/2019
14/11/2019
10/11/2019
09/11/2019
09/11/2019
09/11/2019
09/11/2019
05/11/2019
05/11/2019
05/11/2019
05/11/2019

 

thank you

 

RIchard

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

You can use the today function in a calculate like the following:

Measure =
CALCULATE (
    COUNT ( 'Table'[Date Built] );
    'Table'[Date Built]
        >= ( TODAY () - 7 )
)

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily. 

View solution in original post

Anonymous
Not applicable

Hi @cottrera,


Create a measure to count dates for the past 7 days as like below,

Dates_Count = CALCULATE(COUNT('Date'[Date Built]),'Date'[Date Built]>=TODAY()-7)
please find the below screenshot FYR.

DateSet:
Date.PNG
Output:
Dates_Count.PNG
 
Best Regards,
@Mail2inba4

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @cottrera,


Create a measure to count dates for the past 7 days as like below,

Dates_Count = CALCULATE(COUNT('Date'[Date Built]),'Date'[Date Built]>=TODAY()-7)
please find the below screenshot FYR.

DateSet:
Date.PNG
Output:
Dates_Count.PNG
 
Best Regards,
@Mail2inba4

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

You can use the today function in a calculate like the following:

Measure =
CALCULATE (
    COUNT ( 'Table'[Date Built] );
    'Table'[Date Built]
        >= ( TODAY () - 7 )
)

Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily. 

Perfect thank you for the quick response

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.