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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Create sumif measure using date as filter .pbix example attached

I'm trying to recreate a sumif in excel and using the date as my filter. The date table seems to make this difficult (for me). I think this should be easy but I'm stuck. Here is an example model: https://1drv.ms/u/s!AvCirXUmRp-JhcBp6JcNo0IvAG9-Xg?e=SekKRi

 

Below is my data in excel with the result or visual I want to create at the bottom. My excel formula is this: =SUMIF(A1:A6,"<="&A10,B1:B6) where it looks at the date and filters the sum based on the date. How do I create a measure like this to replicate my excel formula? 

 

sumif with date.png

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

For calculated column , you can use the following formula:

 

Column = CALCULATE(SUM('Data Table'[Value]),FILTER('Data Table','Data Table'[Date]<=EARLIER('Data Table'[Date])))

 

Capture2.PNG

 

For measure , you can use the following measure:

 

accumulative total = CALCULATE(SUM('Data Table'[Value]),FILTER(ALL('Data Table'),'Data Table'[Date]<=MAX('Data Table'[Date])))

 

Capture3.PNG

 

If this post help, please consider accept it as the solution to help other member find it more quickly.

 

Best Regards,

Dedmon Dai

jdbuchanan71
Super User
Super User

@jcueland

It's going to be something on this line.

Cumulative Value = 
VAR _MaxDate = LASTDATE ( 'Date Table'[Date] )

RETURN
CALCULATE (
    SUM('Data Table'[Value]),
    FILTER ( 
        ALLSELECTED('Date Table'[Date]),
        'Date Table'[Date] <= _MaxDate)
)

jdbuchanan71_0-1604597311296.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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