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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vasale
Regular Visitor

SumIFs Statements in PowerBI

Hello, 

 

I am currently trying to create a DAX formula similar to what I use in excel, unfortunately I am struggling with how to create it in PowerBI as the formulas I am using is not giving me the correct information. 

 

I need to find the booking pace. In excel I use:  = SUMIFS(Units ,Event Dates >= start of the month (January) , Event Dates <= End of the month (January) ,Bookings <= Today -1.

 

Any assistance would be greatly appreaciated. 

 

 

6 REPLIES 6
vasale
Regular Visitor

Hello, 

 

Back again with the following Syntax: It is working now that I have removed the "<=" from Endofmonth because I was getting a syntax error. However, when I do the same formula in excel. I get a different answer than what PowerBi is displaying. Below is the DAX formula. 

 

DCO Booking Pace = SUMX(
FILTER(
'Bookings Query',
'Bookings Query'[EventDate] > STARTOFMONTH('Bookings Query'[EventDate]) && ENDOFMONTH('Bookings Query'[EventDate]) && 'Bookings Query'[BookDate]<= TODAY()-1),
'Bookings Query'[Bookings])

hi @vasale 

Are you calculating MTD? Measure or column? Without a calendar table, try a measure like:
DCO Booking Pace = 
VAR currentmonth=
MAX('Bookings Query'[EventDate])
RETURN
SUMX(
    FILTER(
        'Bookings Query',
        FORMAT('Bookings Query'[EventDate], "yymm"= FORMAT(currentmonth, "yymm"
        &&Bookings Query'[EventDate]<TODAY()
    ),
    'Bookings Query'[Bookings]
)
andhiii079845
Super User
Super User

Please show your measure. 🙂





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

Proud to be a Super User!




FreemanZ
Super User
Super User

hi @vasale 

try like:

Measure =
SUMX(
    FILTER(
        TableName,
        MONTH(TableName[Event Dates])=1
           &&YEAR(TableName[Event Dates])=2023
          &&TableName[Bookings]<TODAY()
     ),
    TableName[Units]
)
andhiii079845
Super User
Super User

=sumx(FILTER(table,table[Event Dates] >= "Startofmonth" && table[Event Dates] <= "Endofmonth" &&  table[Bookings]<=TODAY()-1 ),table[Units])

I hope I forget nothing. For better help show us a good data example and all involved tables.





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

Proud to be a Super User!




I keep getting a syntax error with "<=" on the second statement where it states <= endofmonth 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors