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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
vwiles84
Helper III
Helper III

Sum 2 measures while excluding a date

I have a measure I need to create that will sum two values but not sum them if the date is a particular date range.  I don't want to exclude the data from being in the total, but I don't want it to sum the 2 values together. Can anyone assist with the syntax of the Dax measure?  Sample of the data attached.  I would like to sum donatyion qty - ALL with Donor count but NOT sum if the date is X.  If the date is X, then the value will be only the Donor count filed. Screenshot 2024-05-08 112625.png

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

maybe you can try ,

=if(max('Date')=date(2023,3,22)||max('Date')=date(2023,3,23),[Donor Count], [Total Store Donor Count])





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

Proud to be a Super User!




View solution in original post

AndyEagleton
Frequent Visitor

This is essentially an IF statement impacting the line values but not the total. Assuming dates to exclude is a hard coded range somethingl like this:

Total * =

VAR DatesToExclude = CALENDAR ( DATE ( 2020, 3, 4 ), DATE ( 2020, 3, 10 ) )

VAR CurrentDate = SELECTEDVALUE ( Dates[Date] )

RETURN
    IF ( CurrentDate IN DatesToExclude, [Donor Count], [Donor Count] + [Donation ALL] )

 

View solution in original post

4 REPLIES 4
AndyEagleton
Frequent Visitor

This is essentially an IF statement impacting the line values but not the total. Assuming dates to exclude is a hard coded range somethingl like this:

Total * =

VAR DatesToExclude = CALENDAR ( DATE ( 2020, 3, 4 ), DATE ( 2020, 3, 10 ) )

VAR CurrentDate = SELECTEDVALUE ( Dates[Date] )

RETURN
    IF ( CurrentDate IN DatesToExclude, [Donor Count], [Donor Count] + [Donation ALL] )

 

ryan_mayu
Super User
Super User

maybe you can try ,

=if(max('Date')=date(2023,3,22)||max('Date')=date(2023,3,23),[Donor Count], [Total Store Donor Count])





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

Proud to be a Super User!




Thanks. 

you are welcome





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

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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