Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RSSILVA_22
Helper I
Helper I

calculated column help

I have the following table below:

RSSILVA_22_0-1649695254122.png

 

the field "cod client" is repeated several times in the table.

I need a column that shows the largest date, before the current record.

 

example: "cod de cliente" AAAAAAA tem o último registro com a data 2022-04-11. The next column should show the date 2022-03-05. In this record (2022-03-05) must be the largest datan before it. if there is no previous record show empty.

 

If anyone can help, I'd be grateful.

 

 

https://drive.google.com/file/d/1HRYhWWKty2YUXNPYnYb_YPZlFbx8sMa7/view?usp=sharing 

1 ACCEPTED SOLUTION

Hi @RSSILVA_22 
Here is the sample file withe workable solution https://www.dropbox.com/t/KT0CShGmy8yTXvEc

Previous Date = 
VAR CurrentDate = pratic[date_value]
VAR CurrentClientTable =
    CALCULATETABLE ( pratic, ALLEXCEPT ( pratic, pratic[cod_client] ) )
RETURN
    MAXX (
        FILTER ( CurrentClientTable, pratic[date_value] < CurrentDate ),
        pratic[date_value]
    )

1.png

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @RSSILVA_22

you can try

Previous Date =
VAR CurrentDate = Table1[date_value]
VAR CurrentClientTable =
    CALCULATETABLE ( Table1, ALLEXCEPT ( Table1, Table1[code_client] ) )
RETURN
    MAXX (
        FILTER ( Table1, Table1[date_value] < CurrentDate ),
        Table1[CurrentDate]
    )

did not work. He made the date -1 The expected was to bring the date of the previous registration.

 

RSSILVA_22_0-1649715250425.png

 

Hi @RSSILVA_22 
Here is the sample file withe workable solution https://www.dropbox.com/t/KT0CShGmy8yTXvEc

Previous Date = 
VAR CurrentDate = pratic[date_value]
VAR CurrentClientTable =
    CALCULATETABLE ( pratic, ALLEXCEPT ( pratic, pratic[cod_client] ) )
RETURN
    MAXX (
        FILTER ( CurrentClientTable, pratic[date_value] < CurrentDate ),
        pratic[date_value]
    )

1.png

Hi tamerj1,

Thanks for your help.

Thank you for taking the time to review and respond.

It's good to have this community and people like you willing to help.

 

@rodrigo09062015 
Most welcome. I guess you are using two different user accounts. I was little confused 🙂
If my reply satisfies your requirement, kindly consider marking it as acceptable solution.

Have a great day!

hello, that's why I wasn't finding the option to accept a solution. I was logging into the personal computer (user rodrigo09062015) and I forgot that I had posted on the company account.

thanks

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.