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
RKM
Helper IV
Helper IV

Check If a date is between two dates from a different table

Hi There,

This might be a very simple topic but I am struggling with DAX. Could someone please help.

I have a table [Table_CallLog] having one of it's column named 'Call_DateTime'. I have another Table [Table_DSTReference] with three columns, Year, DST_StartDateTime and DST_EndDateTime. Which gives a reference to Start and End of Daylight saving time for several years.

 

What I tried doing is..

Step 1. Added a Column [named as Year_CallLog] (In Source SQL itself) to get Year(Call_DateTime).

Step 2. Joined Table_CallLog with Table_DSTReference based on Year_CallLog to Year (Many to 1).

Step 3. (This is where I'm stuck) Trying to add a measure/calculated column in Table_CallLog, which will check

 

if(Table_CallLog.CallDateTime >=  Table_DSTReference.DST_StartDateTime && Table_CallLog.CallDateTime <  Table_DSTReference.DST_EndDateTime, "Summer", "Winter")

 

Is this correct syntax? seems I'm unable to write it that way.

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @RKM 

 

If you want a DAX Calculated Column, connect the Year column in the two tables and use it

 

Column = IF(Table_CallLog[Call_DateTime]>=RELATED(Table_DSTReference[DST_StartDateTime])&&Table_CallLog[Call_DateTime]<RELATED(Table_DSTReference[DST_EndDateTime]),"Summer","Winter")

View solution in original post

1 REPLY 1
Vera_33
Resident Rockstar
Resident Rockstar

Hi @RKM 

 

If you want a DAX Calculated Column, connect the Year column in the two tables and use it

 

Column = IF(Table_CallLog[Call_DateTime]>=RELATED(Table_DSTReference[DST_StartDateTime])&&Table_CallLog[Call_DateTime]<RELATED(Table_DSTReference[DST_EndDateTime]),"Summer","Winter")

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.