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
Anonymous
Not applicable

Calculating metric for 7 days ago in future times

Hi everyone,
trying to compute a metric by hour of day, and compute the same number for 7 days ago.

My metric is : 
Purchased (#) = CALCULATE(DISTINCTCOUNT(fact_purchased[id_product])

The metric for 7 days before is : 
CALCULATE([Purchased (#)],
DATESINPERIOD ('dim_date'[Date],
max('dim_date'[Date])-7,-1,DAY))

I have a dim_date table and a dim_time table (hourly); data being groupped by date and start of hour in my fact tables

The screenshot i am sharing shows the data after a refresh that happened today (apr 18th) at 11 AM. The figures it is showing after 11 AM are not correct for previous week; which makes sens because there is no data point for apr 18th after 11. 
Any idea of how i could display data for after 11 AM anyways ?

Thanks a lot

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous ,

You can consider to use date function to manually define filter date range to get correspond records:

Time Intelligence "The Hard Way" (TITHW)
Regards,

Xiaoxin Sheng

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.