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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
notalex
Frequent Visitor

Calculate the difference between the latest quantity and the earliest quantity

Hey, fellow Power Bi friends 

I want to calculate the diffrence between the latest quantity and the earliest quanitity based on indexes

indexitem_quantity 

1

5
22
35
46
59


for example i want to know the diffrence between the item_qunaitity of the 1st index and the item_quanity of the 5th index whch is 80% ((9-5)/5)

All help will be much appreciated 

1 REPLY 1
andhiii079845
Solution Sage
Solution Sage

Try this:

MeasureIndex = 
 VAR __minindex = CALCULATE(minx('Table','Table'[index]))
 VAR __maxindex = CALCULATE(maxx('Table','Table'[index]))
 VAR __maxindexvalue = CALCULATE(sumx(FILTER('Table','Table'[index]=__maxindex),'Table'[item_quantity ]))
 VAR __minindexvalue = CALCULATE(sumx(FILTER('Table','Table'[index]=__minindex),'Table'[item_quantity ]))
 RETURN (__maxindexvalue-__minindexvalue)/__minindexvalue

 





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

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.