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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Measure that replicates sumifs from Excel with a connected date table - .pbix example attached

I am trying to replicate a sumifs from excel into a measure

 

I have two tables: Data Table that is connected to a Date Table

 

I want my sumifs measure to sum the values based on two criteria:

1. Condition of the field 'Start or End date" must be = "Start Date", and

2. The date is < or = to the date from my date table.

 

I've gotten this to work if the date table is NOT attached. But I need the date table attached to the data table for other visuals I need.

 

I've attached an example .pbix and below is a picture of what I'm trying to replicate in Excel

https://1drv.ms/u/s!AvCirXUmRp-JhcEC8q0HiqMlMjLQUQ?e=tDURhu

 

 

 

sumifs before date.png 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression to get your result.

 

Sum Start Dates =
VAR maxdate =
    MAX ( 'Date Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Unpivoted start and end date'[Value] ),
        ALL ( 'Date Table'[Date] ),
        'Unpivoted start and end date'[Date] <= maxdate,
        'Unpivoted start and end date'[Start or End Date] = "Start Date"
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try with date from the date table

measure =
var _max = maxx(allselected('Date'), 'Date'[Date])
return
sumx(summarize(calculateTable('Data', filter(all('Date'), 'Date'[Date] <_max)), [Value]),[Value])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.  Since there are way too many dates in your Date Table, you will see all those dates in the visual as well.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression to get your result.

 

Sum Start Dates =
VAR maxdate =
    MAX ( 'Date Table'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Unpivoted start and end date'[Value] ),
        ALL ( 'Date Table'[Date] ),
        'Unpivoted start and end date'[Date] <= maxdate,
        'Unpivoted start and end date'[Start or End Date] = "Start Date"
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.