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
snifer
Post Patron
Post Patron

difference date

 

 

my problem is that  I've two column

column 1 and column 2

they are date dd/mm/yyyy

I need to say that the row in column 1 are in a month before than the row in  column 2 ( could be 2 or more month of difference) ture false

 

I need to find a way to make give result so in 12/2017 is before than 01/2018

1 ACCEPTED SOLUTION
Anonymous
Not applicable

If you are not care about the time interval between column1 and column2, and just want to mark two days from different months, you can use the following DAX.

 

Column = IF(DATEDIFF(MIN(TimeDiff[Column1],TimeDiff[Column2]),MAX(TimeDiff[Column1],TimeDiff[Column2]),MONTH)>=1,TRUE())

MIN and MAX function is just used for in case you have any date in Column 1 is early than the corresponding one in Column 2.

2018-07-11_15-33-09.png

 

 

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Regarding for "one month before", are you saying the date in column 2 should be at least 30 days older than the one in column 1? If this is the case, you can refer to the following DAX to get the rough result.

 

MoreThan1M = IF(DATEDIFF(TimeDiff[Column1],TimeDiff[Column2],DAY)>=30&&DATEDIFF(TimeDiff[Column1],TimeDiff[Column2],MONTH)>=1,TRUE())

2018-07-11_13-38-06.png

 

 

for example in case of 29 march and 1 april, this is a different month, it will work rules of more than 30 days?

Anonymous
Not applicable

If you are not care about the time interval between column1 and column2, and just want to mark two days from different months, you can use the following DAX.

 

Column = IF(DATEDIFF(MIN(TimeDiff[Column1],TimeDiff[Column2]),MAX(TimeDiff[Column1],TimeDiff[Column2]),MONTH)>=1,TRUE())

MIN and MAX function is just used for in case you have any date in Column 1 is early than the corresponding one in Column 2.

2018-07-11_15-33-09.png

 

 

 

 

v-yulgu-msft
Employee
Employee

Hi @snifer,

 

Do you want to check whether the date in column1 is one month before that in column2? If yes, return true, otherwise return false.

 

You can add a calculated column like this:

check difference = IF(DATEDIFF(Table1[Column1],Table1[Column2],MONTH)=1,TRUE(),FALSE())

1.PNG

 

Best regards,

Yuliana Gu

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

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.