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
jaltoft
Resolver I
Resolver I

Previous date in Calculated column

Hello,

 

I have some data in which I have brought back MAX visit dates from a SQL database into powerBI. Column a which would be report week so all the data is in a is marked the same date. Column B is the client id. Column C is the Maximum visit date of each client, each client can possibly be visited more than once in a week.

 

I want to build a custom column to allow me to show the previous visit date to the maximum date in column C.

 

Can anyone help me on how to do this?

 

Thanks all

2 ACCEPTED SOLUTIONS

Column A Column B Column C Desired output
13/12/2020 15616 12/12/2020 09/12/2020
13/12/2020 16515 10/12/2020 10/12/2020
13/12/2020 15688 10/12/2020 10/12/2020
13/12/2020 11111 09/12/2020 08/12/2020
13/12/2020 15616 09/12/2020 09/12/2020
13/12/2020 11111 08/12/2020 08/12/2020

I hope this helps? @HotChilli

View solution in original post

Hi @jaltoft 

I use your sample to have a test.

Calculated column:

 

 

Previous date = MINX(FILTER('Table','Table'[Column B]=EARLIER('Table'[Column B])),'Table'[Column C ])

 

 

Result is as below.

1.png

 

Best Regards,

Rico Zhou

 

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

4 REPLIES 4
jaltoft
Resolver I
Resolver I

Perfect, thanks @RicoZhou

HotChilli
Super User
Super User

Can you provide a small data sample (not a picture) please and show the desired output?

I'm sure someone can help

Column A Column B Column C Desired output
13/12/2020 15616 12/12/2020 09/12/2020
13/12/2020 16515 10/12/2020 10/12/2020
13/12/2020 15688 10/12/2020 10/12/2020
13/12/2020 11111 09/12/2020 08/12/2020
13/12/2020 15616 09/12/2020 09/12/2020
13/12/2020 11111 08/12/2020 08/12/2020

I hope this helps? @HotChilli

Hi @jaltoft 

I use your sample to have a test.

Calculated column:

 

 

Previous date = MINX(FILTER('Table','Table'[Column B]=EARLIER('Table'[Column B])),'Table'[Column C ])

 

 

Result is as below.

1.png

 

Best Regards,

Rico Zhou

 

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.