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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Compare two adjacent records in a chart

Hi

I am generating the below chart and I would like to be able to campare any two adjacent values in it

I thought of using the ERLEIER function that would give me the value of the point before the current one.

Comunity power  BI.PNG

 

 

The way I see it, it would give me something like this.
Previous Val = CALCULATE([Value]);FILTER(MyTable; EARLIER(MyTable[Batch_number])<MyTable[Batch_number]))
 
The problem is that MyTable[Batch_number] is a string variable and the smaller operator (<) doesn't seem to be working.
 
An idea on how I can atcheave my goeal ?
 
Thanks for the help
 
 

 

 

1 REPLY 1
Nathaniel_C
Community Champion
Community Champion

Hi @Anonymous ,

Measure = 
var _curr = MyTable[Batch_number]
var _calc = CALCULATE(MAX(MyTable[Batch_number]),MyTable[Batch_number]<curr)
return _calc

It will be something like this, but not exactly because you did not provide enough info. Your column names would at least be helpful. However maybe this will give you the idea.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Please read this post to get your question answered more quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.