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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Sum between two dates

Hi,

 

In one of my reports I use TOTALMTD to give the monthly values of that month. However I need a daxformula that summarize a value between two dates (will be a static number throughout the report.) but I can't seem to get it to work.

 

I want to calculate the number of bus salesmen between the dates 2019/02/01-2019/02/28.

 

I have created a calendar table as well that I use for my TOTALMTD. Does anyone know why it does not work?

Capture.PNG

 
 

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @Oscar1133 ,

Here are 2 measures that can satisfy your need:

Test bus salesmen=CALCULATE(SUM(ddd[RT Bus Salesmen]),DATESBETWEEN('Calendar table'[Date],DATE(2019,02,01),DATE(2019,02,28)))

O

Test bus salesmen=CALCULATE(SUM(ddd[RT Bus Salesmen]),FILTER(ALLSELECTED('Calendar table'),'Calendar table'[Date]>=DATE(2019,02,01) && 'Calendar table'[Date]<=DATE(2019,02,28)))

Saludos
Kelly
Did I answer your question? Mark my position as a solution!

View solution in original post

5 REPLIES 5
v-kelly-msft
Community Support
Community Support

Hi @Oscar1133 ,

Here are 2 measures that can satisfy your need:

Test bus salesmen=CALCULATE(SUM(ddd[RT Bus Salesmen]),DATESBETWEEN('Calendar table'[Date],DATE(2019,02,01),DATE(2019,02,28)))

O

Test bus salesmen=CALCULATE(SUM(ddd[RT Bus Salesmen]),FILTER(ALLSELECTED('Calendar table'),'Calendar table'[Date]>=DATE(2019,02,01) && 'Calendar table'[Date]<=DATE(2019,02,28)))

Saludos
Kelly
Did I answer your question? Mark my position as a solution!

excellent!! contribution!! papaaa!!

Hi, I'm starting with Powr BI and I'm getting to know the DAX features.

I'd like to know if there's a way to do the following with DAX.

I have a table with the following data:

TeamOriginDestinationDeparture DateArrival DateDistance kmsTotal Distance
T1Planta1Almacen101/03/2021 02:0101/03/2021 10:01150292
T1Almacen1Planta101/03/2021 11:1001/03/2021 19:01142
T1Planta1Almacen202/03/2021 03:0102/03/2021 12:01210420
T1Almacen2Planta102/03/2021 13:1002/03/2021 22:01210
T1Planta1Bodega103/03/2021 02:0103/03/2021 02:317299
T1Bodega1Almacen103/03/2021 03:0103/03/2021 10:01150
T1Almacen1Planta103/03/2021 11:1003/03/2021 19:01142

Each row represents a section of the route and its distance, I need to be able to add the distance of the different sections and put it in a total, this in excel I do with formulas, but with DAX I can not find the way.

Thank you for your attention, greetings...

Hi  @Syndicate_Admin ,

 

Better create a new thread,then we will help to follow it.

 

Best Regards,
Kelly

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

az38
Community Champion
Community Champion

hi @Anonymous 

try without filter and use more appropriate date statement, like

 

= CALCULATE( SUM(ddd[RT Bus Salesmen]); DATESBETWEEN(ddd[Date];DATE(2019;2;1); DATE(2019;2;28)) )

 

 


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

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.