cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Sum by date with Start date and End date

I'm trying to get a sum  of Count (hoping to filter using the Timeline slicer).  If the slicer is filtering by year, I'd want any project to be included in the sum if the Start Date to End Date contained the filtered Year.   In the set below, if the slicer was filtered to 2015, I'd want it to return 675 (projects 1-3).

 

If the slicer was filtered down to an individual day, I'd want the sum to included all projects where the Start Date to End date includes that filtered date.  So if it was filtered to 4/1/2015 it would sum Project 2 and Project 3.

 

Capture.PNG

 

I appreciate any help.


Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: Sum by date with Start date and End date

 

 if you have a date slicer linked to a table named Dates then try

 

 

=
VAR MnDte =
    MIN ( Dates[Date] )
VAR MxDte =
    MAX ( Dates[Date] )
RETURN
    CALCULATE (
        SUM ( Projects[Count] ),
        NOT ( Projects[Start Date] > MxDte ),
        NOT ( Projects[End Date] < MnDte )
    )

 


 


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


Proud to be a Datanaut!  

View solution in original post

3 REPLIES 3
Highlighted
Solution Sage
Solution Sage

Re: Sum by date with Start date and End date

 

 if you have a date slicer linked to a table named Dates then try

 

 

=
VAR MnDte =
    MIN ( Dates[Date] )
VAR MxDte =
    MAX ( Dates[Date] )
RETURN
    CALCULATE (
        SUM ( Projects[Count] ),
        NOT ( Projects[Start Date] > MxDte ),
        NOT ( Projects[End Date] < MnDte )
    )

 


 


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


Proud to be a Datanaut!  

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Sum by date with Start date and End date

Not sure if I am looking at your actual source data or what your slicer is based on, start or end date. Take a look this measure to see if it gets you closer to what you are looking for. It is designed to calculate things based upon slicer selections. 

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Most-Amazing-Mind-Blowing-Dynamic-Slicer...


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted
Frequent Visitor

Re: Sum by date with Start date and End date

Perfect - thank you so much!

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors