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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
adam_macs
Helper I
Helper I

Calculating dates > 365 days from 3 columns

Hi, I am creating a report that examines CRM leads and the date that there was last an activity (email, phone call, appointment).

 

I would like to create a measure that returns TRUE, FALSE, if the maximum date from the 3 activity date columns (which sit in different tables) is >365 days from Today() return TRUE. And if all three date columns are blank also return TRUE. 

 

I essentially want to filter all the leads that have had no activity on them for greater than a year (with the end purpose being to flag them with the lead owners). Is this possible with my current schema? Or should I create some calculated columns using LOOKUPVALUE?

Leads & their latest activity datesLeads & their latest activity dates

 

Data ModelData Model

 

 

2 ACCEPTED SOLUTIONS

@adam_macs 

You should be creating this calculted column in the kegacyleads table. 

View solution in original post

tamerj1
Community Champion
Community Champion

@adam_macs 

Perhaps DATEDIFF returns blank if any of the dates is blank. I think the simple subtraction will do the job

Status =
VAR A =
RELATED ( appointments[creationDate] )
VAR E =
RELATED ( emails[creationDate] )
VAR PH =
RELATED ( phonecalls[creationDate] )
VAR LastActivity =
MAXX ( { A, E, PH }, [Value] )
RETURN
IF ( INT ( TODAY ( ) - LastActivity ) ) < 365, "Active", "Inactive" )

View solution in original post

7 REPLIES 7
tamerj1
Community Champion
Community Champion

@adam_macs 

Perhaps DATEDIFF returns blank if any of the dates is blank. I think the simple subtraction will do the job

Status =
VAR A =
RELATED ( appointments[creationDate] )
VAR E =
RELATED ( emails[creationDate] )
VAR PH =
RELATED ( phonecalls[creationDate] )
VAR LastActivity =
MAXX ( { A, E, PH }, [Value] )
RETURN
IF ( INT ( TODAY ( ) - LastActivity ) ) < 365, "Active", "Inactive" )

tamerj1
Community Champion
Community Champion

Hi @adam_macs 

Please try

Status =
VAR A =
RELATED ( appointments[creationDate] )
VAR E =
RELATED ( emails[creationDate] )
VAR PH =
RELATED ( phonecalls[creationDate] )
VAR LastActivity =
MAXX ( { A, E, PH }, [Value] )
RETURN
IF ( DATEDIFF ( LastActivity, TODAY (), DAY ) < 365, "Active", "Inactive" )

hi @tamerj1 , it doesn't seem to be picking up the relationship for some reason and returns: 

The column 'appointments[creationDate]' either doesn't exist or doesn't have a relationship to any table available in the current context.

adam_macs_1-1675961542766.png

 

@adam_macs 

You should be creating this calculted column in the kegacyleads table. 

Thats worked! Thankyou. One problem is it is show leads with no dates at all as active. Any ideas on how to sidestep this and show them as inactive?

adam_macs_0-1675962020650.png

@adam_macs 

Status =
VAR A =
RELATED ( appointments[creationDate] )
VAR E =
RELATED ( emails[creationDate] )
VAR PH =
RELATED ( phonecalls[creationDate] )
VAR LastActivity =
MAXX ( { A, E, PH }, [Value] )
RETURN
IF ( DATEDIFF ( COALESCE ( LastActivity, TODAY ( ) ), TODAY (), DAY ) < 365, "Active", "Inactive" )

Unfortunately still feeding as active with that updated code: 

adam_macs_0-1675962411172.png

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.