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
joshua1990
Post Prodigy
Post Prodigy

CALCULATE SUM for specific range

Hi experts!

I have a calendar, a dimensional and a transactional table.

Then I have a matrix that is filtered for the current week.

This matrix shows me the sales for the current week.

In addition, I would like to get the sales (table transactional) that happened between the last Saturday and today.

How is this possible by using DAX?

CALCULATE with REMOVEFILTERS?

1 ACCEPTED SOLUTION

@joshua1990 Well, you could find the last Saturday by doing something like this:

Measure =
  VAR __Calendar = ADDCOLUMNS(CALENDAR(TODAY()-7,TODAY()),"__Weekday",WEEKDAY([Date],2))
  VAR __LastSaturday = MINX(FILTER(__Calendar,[__Weekday]=6),[Date])
RETURN
  CALCULATE([someting],ALL('Dates'),'Dates'[Date]>=__LastSaturday,'Dates'[Date]<=TODAY())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@joshua1990 Correct, you could use REMOVEFILTERS or ALL/ALLEXCEPT in order to override filter context within the measure. Sample data would allow more specificity.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler : Thanks a lot! How can the range be specified in the function? Any logic that you can share here?

@joshua1990 Well, you could find the last Saturday by doing something like this:

Measure =
  VAR __Calendar = ADDCOLUMNS(CALENDAR(TODAY()-7,TODAY()),"__Weekday",WEEKDAY([Date],2))
  VAR __LastSaturday = MINX(FILTER(__Calendar,[__Weekday]=6),[Date])
RETURN
  CALCULATE([someting],ALL('Dates'),'Dates'[Date]>=__LastSaturday,'Dates'[Date]<=TODAY())


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.