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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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