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
Kemalnugraha
Frequent Visitor

Sum Max Value and second Biggest Value

Hi,

 

I'm trying to make this measurement automatically update every week

 

Delta Sold = (Sales[Total Sold](Sales[Week]=27))-(Sales[Total Sold](Sales[Week]=26))

how should I replace that number? so the Delta always showing update compared to last week when I put this measurement in a card
the thing is week column's format is just number

 

Total SoldWeek
10920
10021
10222
12023
11524
11025
12026
12527
1 ACCEPTED SOLUTION
AntrikshSharma
Super User
Super User

Try something like this.

Measure =
VAR LastVisibleWeek = MAX ( Sales[Week] )
VAR PreviousWeek = LastVisibleWeek - 1
VAR AmountForCurrentWeek =
    CALCULATE ( SUM ( Sales[Total Sold] ), Sales[Week] = LastVisibleWeek )
VAR AmountForPreviousWeek =
    CALCULATE ( SUM ( Sales[Total Sold] ), Sales[Week] = PreviousWeek )
VAR Result = AmountForCurrentWeek - AmountForPreviousWeek
RETURN
    Result

View solution in original post

2 REPLIES 2
harshnathani
Community Champion
Community Champion

Hi @Kemalnugraha ,

 

You will need a Calendar Table with week.

 

Have a look at this blog. (pbix file is attached too).

 

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

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

AntrikshSharma
Super User
Super User

Try something like this.

Measure =
VAR LastVisibleWeek = MAX ( Sales[Week] )
VAR PreviousWeek = LastVisibleWeek - 1
VAR AmountForCurrentWeek =
    CALCULATE ( SUM ( Sales[Total Sold] ), Sales[Week] = LastVisibleWeek )
VAR AmountForPreviousWeek =
    CALCULATE ( SUM ( Sales[Total Sold] ), Sales[Week] = PreviousWeek )
VAR Result = AmountForCurrentWeek - AmountForPreviousWeek
RETURN
    Result

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.