Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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:
| ID | CONTRACT | START | PRODUCT |
| 1 | 1 | 01-01-2016 | A |
| 2 | 3 | 01-01-2016 | C |
| 1 | 4 | 01-01-2019 | B |
| 2 | 5 | 01-01-2017 | A |
| 1 | 6 | 01-01-2018 | C |
The result with PRIVIOUS is:
| ID | CONTRACT | START | PRODUCT | PREVIOUS |
| 1 | 1 | 01-01-2016 | A | |
| 2 | 3 | 01-01-2016 | C | |
| 1 | 4 | 01-01-2019 | B | A-C |
| 2 | 5 | 01-01-2017 | A | C |
| 1 | 6 | 01-01-2018 | C | A |
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
Solved! Go to Solution.
@karlo
Please create a measure
Measure = CALCULATE(CONCATENATEX('Table','Table'[PRODUCT],"-",'Table'[PRODUCT]),FILTER(ALLEXCEPT('Table','Table'[ID]),'Table'[START]<MAX('Table'[START])))
@karlo
Please create a measure
Measure = CALCULATE(CONCATENATEX('Table','Table'[PRODUCT],"-",'Table'[PRODUCT]),FILTER(ALLEXCEPT('Table','Table'[ID]),'Table'[START]<MAX('Table'[START])))
Excellent vimal_parmar, I'll try again
Thank you very much!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 18 | |
| 12 | |
| 11 |