Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear BI Sectarians,
I have a table of clients (primary) related to a table of contracts (foreign). The contracts table has multiple rows (contracts) for each client.
I am trying to write a measure which will return all contract values for those clients whose most recent contract ends within the current fiscal year (this would also exclude those who have renewed).
The CALCULATE filter would look something like this --
DATESBETWEEN ( LAST DATE ( Contracts[Contract End Date] ) , &c.
-- but it returns the error, ""DatesBetween and DatesInPeriod functions are only accepting date column reference as a first argument."
(I've tried to build a virtual column but I can't seem to get that one right.)
Can someone please advise?
Thanks in advance,
Derek
Hi @dkwilson ,
Based on the document, the syntax of the DATESBETWEEN function is below.
DATESBETWEEN(<dates>,<start_date>,<end_date>)
The dates should be a reference to a date/time column.
So for your scenario, I'm afraid that your issue is caused by the LAST DATE ( Contracts[Contract End Date] ).
You'd better enter the <date> with a column like DateTime[DateKey] as the document shows.
Normally, if we want to use Time Intelligence functions, we'd better create a calendar table.
Best Regards,
Cherry
Thank you for your reply, @v-piga-msft .
I actually do have a separate dates/calendar table.
Basically, I'm trying to write a measure that will return the contract value for current clients whose annual contract ends within the current fiscal year and who have not yet renewed. The problem is, Client A has renewed its annual contract and, therefore, the end date for its latest / most recent contract falls outside the current fiscal year. Its original contract does end within the current fiscal year but I want to exlude Client A from this measure by using the contract end date from its latest / most recent contract.
I hope I've explained myself clearly. My first thought is to find some alternative to a "DATESBETWEEN ( LASTDATE ( ..." filter but I would be grateful for any advice.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.