Dynamic Dates

dpotta

New Member
Joined
Aug 16, 2011
Messages
29
Hi

In the following measure I would like to replace the DATE(2016,9,30) with a Dynamic Date based on the End Date of The Previous Quarter by using TODAY().

I've tried a few things but I'm not sure where I am going wrong. Any suggestions most welcome.

CreatedPriorToEndOfLastQuarter = calculate ([PI_All Rows], filter(vwProperty,vwProperty[Date Created]<=DATE(2016,9,30)))

Thank you

Dave
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If you want the last date of the previous quarter using a separate, standard practice Calendar table, this is easy enough:

Code:
[COLOR=#333333]CreatedPriorToEndOfLastQuarter = calculate ([PI_All Rows], filter(vwProperty,vwProperty[Date Created]<=ENDOFQUARTER(PREVIOUSQUARTER(Calendar[Date]))  ))[/COLOR]

But this has a number of caveats: First, It determines the current quarter based on first date visible in the current filter context. Second, it works using time intelligence functions which really requires the separate Calendar table (In fact any way you go, you really need this separate table). Time Intelligence functions works by shifting the dates visible in the current filter context for the Calendar table but won't "make" dates that don't already exist in the Calendar table.

If you really need to use TODAY() function (meaning you want previous quarter based on system date of when report is run ) then while i have not tried it, something like this should work. Replace my change above with this:

Code:
FILTER ( ALL(Calendar), Calendar[Date] = TODAY() )

If you are using Power BI Desktop or Excel 2016, I'd put the code result into a variable first.

Code:
VAR Todays_Date = FILTER ( ALL(Calendar), Calendar[Date] = TODAY() )
Code:
[COLOR=#333333]CreatedPriorToEndOfLastQuarter = calculate ([PI_All Rows], filter(vwProperty,vwProperty[Date Created]<=Todays_Date  ))[/COLOR]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,813
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top