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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
BugmanJ
Helper V
Helper V

Measure where Today is max date from Slicer

Hello,

I am currently calculating the last 7 days of sale from Today

Prior 7 Days Sales = ((CALCULATE (

    SUM([Total Sales]),'Sales Table'[Day Date] > today()-8))-(CALCULATE (
    SUM([Total Sales]),'Sales Table'[Day Date] = today())))/7
 
This works fine, but I have now a need to dynamically change the "today" part to be something from a slicer. E.g. I can drag the slicer to 06th July and I need to calcualte the last 7 days of sale from then.

What do I need to change to have something changes depending on the max date in the slicer?

I have a date table controlling the data
 
Thank you
2 REPLIES 2
Anonymous
Not applicable

Hi @BugmanJ ,

Please update the formula of measure [Prior 7 Days Sales] as below and check if it can return your expected result...

Prior 7 Days Sales =
(
(
CALCULATE (
SUM ( [Total Sales] ),
'Sales Table'[Day Date]
> MAX ( 'slicertable'[Date] ) - 8
)
)
- (
CALCULATE (
SUM ( [Total Sales] ),
'Sales Table'[Day Date] = MAX ( 'slicertable'[Date] )
)
)
) / 7

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

tamerj1
Super User
Super User

Hi @BugmanJ 

please try

VAR Greeting = "Good Morning"
VAR FullName = "/CompanyNET/AnneAlavarci/" --Use USERNAME ( ) Function
VAR Items = SUBSTITUTE ( FullName, "/", "|" )

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.