Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi All,
I'm looking to create a new measure that filters for the last 90 days starting 90 days from the current date. For, example, today is 4/24/2019, I'd like to be able to create a relative date filter that only counts balances from 10/24/2018 to 1/24/2019 (out of laziness I'm pretending every month has 30 days).
I'm thinking I need to do this using DAX, can anyone point me in the direction of an answer?
Thank you,
Chris
Solved! Go to Solution.
Assuming you have a Date table in your model and it is marked as such, I think the following should work.
90 DAYS AFTER = IF( HASONEVALUE('Date'[Date]), DATEADD('Date'[Date], 90, DAY) ) 90 DAYS PRIOR = IF( HASONEVALUE('Date'[Date]), DATEADD('Date'[Date], -90, DAY) ) Total Sales 90 Days = CALCULATE( [Total Sales], DATESBETWEEN( 'Date'[Date], [90 DAYS PRIOR], [90 DAYS AFTER] ) )
Assuming you have a Date table in your model and it is marked as such, I think the following should work.
90 DAYS AFTER = IF( HASONEVALUE('Date'[Date]), DATEADD('Date'[Date], 90, DAY) ) 90 DAYS PRIOR = IF( HASONEVALUE('Date'[Date]), DATEADD('Date'[Date], -90, DAY) ) Total Sales 90 Days = CALCULATE( [Total Sales], DATESBETWEEN( 'Date'[Date], [90 DAYS PRIOR], [90 DAYS AFTER] ) )
Perfect! Thanks, Nick!
I had to change the -90 to -180, otherwise, that worked as I had hoped. That was more of an issue with how I worded the question though.
No problem. Glad you were able to get it to work. The built-in time intelligence functions are pretty handy