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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.