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
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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.