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

DAX - Problem to identify previous record

Hi everyone,

 

I'm starting with DAX and I need your help, for a particular record I am trying to identify the previous record if the start date of the previous record is less. Also, if there is more than one record, sort them alphabetically and include them as groups.

 

For example, considering the following matrix:

 

IDCONTRACTSTARTPRODUCT
1101-01-2016A
2301-01-2016C
1401-01-2019B
2501-01-2017A
1601-01-2018C

 

The result with PRIVIOUS is:

 

IDCONTRACTSTARTPRODUCTPREVIOUS
1101-01-2016A 
2301-01-2016C 
1401-01-2019BA-C
2501-01-2017AC
1601-01-2018CA

 

I would greatly appreciate your help or comments, I have done several tests without good results. In some cases I have memory problems (I have 8GB RAM).

 

Thank you

Karlo

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@karlo 
Please create a measure 

Measure = CALCULATE(CONCATENATEX('Table','Table'[PRODUCT],"-",'Table'[PRODUCT]),FILTER(ALLEXCEPT('Table','Table'[ID]),'Table'[START]<MAX('Table'[START])))

karlo.png 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@karlo 
Please create a measure 

Measure = CALCULATE(CONCATENATEX('Table','Table'[PRODUCT],"-",'Table'[PRODUCT]),FILTER(ALLEXCEPT('Table','Table'[ID]),'Table'[START]<MAX('Table'[START])))

karlo.png 

Excellent vimal_parmar, I'll try again

 

Thank you very much!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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