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
Suryaann
Frequent Visitor

Get the next 5 days date from a date

Hi All,

 

I have a table

 

Date 1        Date2

1/2/2019    1/1/2019

2/2/2019     1/1/2019

3/2/2019     1/1/2019

4/2/2019     1/1/2019

5/2/2019     1/1/2019

1/2/2019    1/2/2019

2/2/2019     1/2/2019

3/2/2019     1/2/2019

4/2/2019     1/2/2019

5/2/2019     1/2/2019

6/2/2019      1/2/2019

 

I want to add a column which will show a Y for the next 5 days from max(date2).I am using direct query connection.

My result table should look like

 

Date 1        Date2             NewCOLUMN

1/2/2019    1/1/2019           N

2/2/2019     1/1/2019           N

3/2/2019     1/1/2019           N

4/2/2019     1/1/2019          N

5/2/2019     1/1/2019          N

1/2/2019    1/2/2019           Y

2/2/2019     1/2/2019          Y

3/2/2019     1/2/2019          Y

4/2/2019     1/2/2019          Y

5/2/2019     1/2/2019           Y

6/2/2019      1/2/2019          N

 

kindly Help

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Suryaann ,

Have you solved the problem?

If you have solved the problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please feel free to ask.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
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-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Suryaann ,

Have you solved the problem?

If you have solved the problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please feel free to ask.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@Suryaann 

What is the criteria by which you are giving NewCOLUMN a "Y" or "N"? The only partial pattern I could see was if Date2 was after 1/1/2019, NewCOLUMN had a "Y" (albeit the last row is a "N"). If this is the case, you could make a calculated column like so (I know the last row is wrong, I just don't know your criteria yet):

Capture.PNGCapture1.PNG

If the criteria involves the difference between Date1 and Date2, you could use the DATEDIFF function: https://docs.microsoft.com/en-us/dax/datediff-function-dax

 

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