Forum Discussion
Find Top - Bottom Performers
- 3 years ago
I found the solution from another post calculating sum for max date.
Instead of using LASTDATE in my formula to find latest date in Sales Table I used MAX.
original code
Margin % Last 28 Days Sales = CALCULATE ( [Total Margin %], DATESINPERIOD ( 'Sales Report'[Sales Date], LASTDATE ( 'Sales Report'[Sales Date] ), -28, DAY ) )updated code
Margin % Last 28 Days Sales_V2 = VAR LatestDate = CALCULATE(MAX('Sales Report'[Sales Date]), ALL('Sales Report')) Return CALCULATE ( [Total Margin %], DATESINPERIOD ( 'Date'[Date], LatestDate, -28, DAY ) )
Hi jamuka ,
Maybe you can try DATESBETWEEN function. Such like below:
sumOf_date =
CALCULATE (
SUM ( 'Table'[Value] ),
DATESBETWEEN ( 'Table'[Date], DATE ( 2022, 9, 25 ), TODAY() )
)
If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hello v-henryk-mstf,
thank you for you reply.
I don't want to add static date to my measure because that means I have to change it every time.
Which at the moment I did by filtering my visual via date filter. I attached a sample file to my post.
kind regards