Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have a measure that aggregate sales for the last seven days, see below. I want this to ignore the date slicer. However that isn't happening. The value should be £220.77K for the last seven days. But if I change the date slicer the value changes and is instead showing the last seven day value from the 06.09.2021.
Can anyone help me understand why this is happening?
Measure = CALCULATE (
'Measures Table'[Sum_Gross_Sales],
DATESBETWEEN (
'Calendar'[Date],
MAX ( 'Calendar'[Date] ) - 7,
MAX ( 'Calendar'[Date] ) - 1
), ALL('Calendar'[Date])
)
Solved! Go to Solution.
The ALL('Calendar'[Date]) is not being applied to the DATESBETWEEN function, it is only being applied to the [Sum_gross_sales] measure, so when you call MAX('Calendar'[Date]) the slicer is still in effect.
If your Calendar table is marked as a date table then you don't need to remove filters from the 'Calendar'[Date] column if you apply another filter to that column, DAX takes care of that automatically. Try using
Last 7 days = CALCULATE( [Sum_Gross_Sales], DATESBETWEEN( 'Calendar'[Date], TODAY() -7, TODAY() - 1) )
Hi,
Could you please try the below measure if it shows the outcome that is expected?
Measure: =
VAR _lastdateincalendartable =
CALCULATE ( MAX ( 'Calendar'[Date] ), REMOVEFILTERS () )
RETURN
CALCULATE (
'Measures Table'[Sum_Gross_Sales],
DATESBETWEEN (
'Calendar'[Date],
_lastdateincalendartable - 7,
_lastdateincalendartable - 1
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
The ALL('Calendar'[Date]) is not being applied to the DATESBETWEEN function, it is only being applied to the [Sum_gross_sales] measure, so when you call MAX('Calendar'[Date]) the slicer is still in effect.
If your Calendar table is marked as a date table then you don't need to remove filters from the 'Calendar'[Date] column if you apply another filter to that column, DAX takes care of that automatically. Try using
Last 7 days = CALCULATE( [Sum_Gross_Sales], DATESBETWEEN( 'Calendar'[Date], TODAY() -7, TODAY() - 1) )
Thank you John, that solved my issues.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
87 | |
84 | |
68 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |