Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

LastDate and FirstDate

Hi,

 

when we use these two functions, i know it's gonna apply to all the data if there is no data applicable. 

 

FIRSTDATE(DATEADD('leads final'[modifiedon (bins)], -12, MONTH)) when i use this functio, if the last year is not available, how can i avoid it to select all the dates? instead, i want it to leave as blank/NA
 
any good ideas? 
1 REPLY 1
Anonymous
Not applicable

Hi there.

 

First of all, you should read this: https://dax.guide/firstdate/ and when you do, please read it WELL with full attention to the DETAILS.

 

Secondly, you should be aware that FIRSTDATE is a table function that returns a TABLE, not a value (even though it can be automatically converted into a value on demand).

 

Thirdly, you should use this function only on A PROPER DATE TABLE. Same is (even more) true for DATEADD. If you don't follow the rules, then you'll be sorry rather sooner than later 🙂 Please mark my words well.

 

FIRSTDATE returns the very first date in the column passed in as the parameter. DATEADD shifts a column by the desired amount of time BUT ONLY IF the shifted period is present in the passed-in column. If not, then BLANK will be returned and hence all other time-related functions will return BLANK. Let me warn you again: DO NOT USE TIME-INTELLIGENCE FUNCTIONS ON NON-DATE TABLES.

 

Best

Darek

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors