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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
User1
New Member

SUMIFs with date range conditionals

Hi all,

I have a table, with columns showing the numbers I want to add up, and columns containing date between which I would not want to add them up.

For example:

Number      Date from       Date to

5                       13/4                   15/4

10                    14/4                    20/4

5                        22/4                    25/4

 

I want to create a second table with a daily tally of the total of the "Number" column, but onkly if the date in question is outside the "Date from - date to" range. Either as a conditional column, or as a measure. For example:

Day               TOTAL

11/4              20

12/4              20

13/4               15

14/4                5

etc.

 

I tried to use the CALCULATE  ( SUM(), FILTER()) functionality, but could not get it to work. Is that the right approach? Or is there a better way to do this?

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

Hi @User1 ,

 

Please create a new date table firstly. And there is not a relationship between the tables.

Example:

Date = CALENDAR(DATE(2020,4,1),DATE(2020,5,1))

 

Then create a measure like this:

Measure =
CALCULATE (
    SUM ( 'Table'[Number] ),
    FILTER (
        'Table',
        MAX ( 'Date'[Date] ) < 'Table'[Date From]
            || MAX ( 'Date'[Date] ) > 'Table'[Date To]
    )
)

7.PNG

 

For more details, please see the attachment.

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xuding-msft
Community Support
Community Support

Hi @User1 ,

 

Please create a new date table firstly. And there is not a relationship between the tables.

Example:

Date = CALENDAR(DATE(2020,4,1),DATE(2020,5,1))

 

Then create a measure like this:

Measure =
CALCULATE (
    SUM ( 'Table'[Number] ),
    FILTER (
        'Table',
        MAX ( 'Date'[Date] ) < 'Table'[Date From]
            || MAX ( 'Date'[Date] ) > 'Table'[Date To]
    )
)

7.PNG

 

For more details, please see the attachment.

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, in the end I got it to work, but I had to use the OR() statement instead of the || (which I assume does the same)?
Thanks anyways 🙂 

amitchandak
Super User
Super User

@User1 , there is a similar problem solved in the file attached after the signature. If that can help

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.