Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I would like to get the previous row value for a text column using DAX.
Example: Text_column
A
B
C
Expected Output:
Text_column, Previous_value
A NULL
B A
C B
Please let me know incase of any clarification.
Thanks in Advance.
Solved! Go to Solution.
In DAX, there's no order internally for records in table. You have to add an index column in your table.
PreviousText = CALCULATE(MAX(Table1[Text]),FILTER(Table1,Table1[Index]=EARLIER(Table1[Index])-1))
Regards,
In DAX, there's no order internally for records in table. You have to add an index column in your table.
PreviousText = CALCULATE(MAX(Table1[Text]),FILTER(Table1,Table1[Index]=EARLIER(Table1[Index])-1))
Regards,
Hi,
@v-sihou-msft I am trying to replicate this and have added the index column, but getting a row context error from the EARLIER function onwards:
previous index = CALCULATE(MAX('Curso Académico'[Curso]);FILTER('Curso Académico';'Curso Académico'[Index]=EARLIER('Curso Académico'[Index]))
Any ideas what I'm doing wrong?
Thanks!
...
is the -1 missing at the end?
previous index = CALCULATE(MAX('Curso Académico'[Curso]);FILTER('Curso Académico';'Curso Académico'[Index]=EARLIER('Curso Académico'[Index])-1))
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
71 | |
70 | |
38 | |
28 | |
26 |
User | Count |
---|---|
97 | |
88 | |
59 | |
43 | |
40 |