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
Anonymous
Not applicable

Minus previous cell value

hi all,

i have this sale table.how do i write the forumla so that the value will show example for Day 1 - 20 sales was made and so on.

I tried using earlier function but lost along the way.

 

DayColumn ADifference
Day 110020
Day 212019
Day 3139149
Day 4188 

 

Thank you very much.

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@Anonymous 

why do you 149, not 49 in the last row?

 

try

Difference = 
var _nextVal = CALCULATE(MIN('Table'[Column A]);FILTER(ALL('Table');'Table'[Column A]>EARLIER('Table'[Column A])))
RETURN
if(_nextVal>=[Column A];_nextVal-[Column A];blank())

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@az38 

is it possible to use column A for calculation only...

Perhaps it something simple but i couldnt get it right...

 

 

 

az38
Community Champion
Community Champion

@Anonymous 

 

try

Difference = [Column A]-CALCULATE(MAX('Table'[Column A]);FILTER(ALL('Table');'Table'[Column A]<EARLIER('Table'[Column A])))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38 

is there a way to show the value for 1st row...

 

az38
Community Champion
Community Champion

@Anonymous 

why do you 149, not 49 in the last row?

 

try

Difference = 
var _nextVal = CALCULATE(MIN('Table'[Column A]);FILTER(ALL('Table');'Table'[Column A]>EARLIER('Table'[Column A])))
RETURN
if(_nextVal>=[Column A];_nextVal-[Column A];blank())

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
az38
Community Champion
Community Champion

hi @Anonymous 

if i understand you correct try a column

 

Difference = [Column A]-CALCULATE(MAX('Table'[Column A]);FILTER(ALL('Table');'Table'[Day]<EARLIER('Table'[Day])))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.