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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
meierli
Helper I
Helper I

Compare dates in two columns and then sum 3rd column

I am using Power Pivot in EXCEL not Power BI.

 

Trying to compare dates with an if statement from two columns and when the date matches I want to sum a 3rd columns.

 

Here is the DAX formula I have, which is not working. What do I need to change to be able to compare the dates and then sum up the values?

I also created date tables for the two date columns. Didn't work either.

 

MM CM:=IF(VALUE('Vendor Trend'[CAP Date Paid])=VALUE('Vendor Trend'[CAP Date Aff]), SUM([TOTAL MM]))

 

MM CM:=IF(VALUE('Calendar'[Date])=VALUE('Calendar_Dt Aff'[Date]), SUM([TOTAL MM]))

 

 

3 REPLIES 3
Anonymous
Not applicable

Hi @meierli 

 

Thank you very much aduguid for your prompt reply.

 

Try this:

 

MM CM = 
CALCULATE(
    SUM('Vendor Trend'[TOTAL MM]),
    FILTER(
        'Vendor Trend',
        'Vendor Trend'[CAP Date Paid] = 'Vendor Trend'[CAP Date Aff]
    )
)

 

MM CM = 
CALCULATE(
    SUM('Vendor Trend'[TOTAL MM]),
    FILTER(
        'Calendar',
        'Calendar'[Date] = 'Calendar_Dt Aff'[Date]
    )
)

 

If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.

 

Regards,

Nono Chen

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

aduguid
Super User
Super User

Try this measure

MM CM :=
CALCULATE(
    SUM('Vendor Trend'[TOTAL MM]),
    'Vendor Trend'[CAP Date Paid] = 'Vendor Trend'[CAP Date Aff]
)

or this one if you're using a calendar table

MM CM :=
CALCULATE(
    SUM('Vendor Trend'[TOTAL MM]),
    'Calendar'[Date] = 'Calendar_Dt Aff'[Date]
)

Thank for your suggestion. But I got enclosed error. Any idea why?

 

meierli_0-1729787825942.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.