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

Using a date plus calculation

I have a table that has sales by store by date over a six month period.

Looking for DAX calculation that can when I chose a specific date say 01/12/2019 plus 14, I can get the sum of the sales for the period contained within i.e. 01/12 and the next 14 days

I then want to use this column to report on stores with zero sales during this period

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,
If you have a date slicer where you can select the date from table DateTable column Date it could be something like this:

 

Sales14Days =

CALCULATE (SUM(['SalesTable'[Sales]); FILTER (ALL(SalesTable[Date]), SalesTable[Date] >= MAX(DateTable[Date] && SalesTable[Date] <= MAX(Date[Date]) + 14))

 

If there are no sales the measure will return BLANK().

 

EDIT: Changed ALL(SalesTable) to ALL(SalesTable[Date]), could perhaps be better, depends on your requirements. 

 

Best Regards // Ulf

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,
If you have a date slicer where you can select the date from table DateTable column Date it could be something like this:

 

Sales14Days =

CALCULATE (SUM(['SalesTable'[Sales]); FILTER (ALL(SalesTable[Date]), SalesTable[Date] >= MAX(DateTable[Date] && SalesTable[Date] <= MAX(Date[Date]) + 14))

 

If there are no sales the measure will return BLANK().

 

EDIT: Changed ALL(SalesTable) to ALL(SalesTable[Date]), could perhaps be better, depends on your requirements. 

 

Best Regards // Ulf

Greg_Deckler
Community Champion
Community Champion

This would be easier if you provided sample data and expected output. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, you can simply add 14 to your date. [Date] + 14. So you could do a filter like [Date] >= Specific Date && [Date] <= Specific Date + 14



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
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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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