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
anmsharma
Helper II
Helper II

Checking the Data in a definite interval and adding the value in Column

Hi Team,

 

I have a requirement that a particular 'Date' needs to be checked if it lies between 'FromDate' and 'ToDate'.

 

If yes, then I need to have separate column as 'NewDate' which will have the value of 'Date' in true condition else ' ' in false.

 

'FromDate' and 'ToDate' is in table 1 and 'NewDate' need to be added in table 1 only

'Date' is in table 2

 

Many Thanks in advance,

Anmol

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@anmsharma,

Create relationship as other post, then create the column using the Dax below.

NewDate = IF(RELATED(Table2[Date])<=Table1[Todate]&&RELATED(Table2[Date])>=Table1[FromDate],RELATED(Table2[Date]),BLANK())

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@anmsharma,

Create relationship as other post, then create the column using the Dax below.

NewDate = IF(RELATED(Table2[Date])<=Table1[Todate]&&RELATED(Table2[Date])>=Table1[FromDate],RELATED(Table2[Date]),BLANK())

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Salvador
Responsive Resident
Responsive Resident

Hi,

 

I'd say you first would need to establish a relationship between both tables (if you dont have it already), and then create a column with an or/if, in table 1, something like
        = or(if(table1[date]<table2[datex];table1[date];"");if(table1[date]>table2[datey];table1[date];""))

 

Regards, 

Salva.

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.