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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
dkc
Frequent Visitor

calculate value between two dates

Hi, 

I have two tables: 

Promo list: with promo ID, customers and contact period (contact start and end date). 

dkc_1-1655100760458.png

Contact list: Customer, contact date and nr. of contacts

dkc_2-1655100820296.png

 

I want to calculate a measure which says: for promo ID XYnumber of contacts have been conducted considering the defined contact periods and participating customers of an Promo ID. I already tried to work with datesbetween formula but was not successful.

Could you pls help me to create the correct measure?

Results expected: 

Promo ID1: 1 contact

Promo ID2: 0 contacts

Promo ID3: 0 contacts

 

Thank you in advance for your support!

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @dkc 

Please try formula as below:

Max Contact Date= 
CALCULATE (
    MAX ( 'Contact list'[Contact Date] ),
    FILTER (
        'Contact list',
        'Contact list'[Customer] = MAX ( 'Promo list'[Customer] )
            && 'Contact list'[Contact Date] >= MAX ( 'Promo list'[Contact Start date] )
            && 'Contact list'[Contact Date] <= MIN ( 'Promo list'[Contact End date] )
    )
)
Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Promo list'[Customer] ),
    FILTER ( 'Promo list', [Max  Contact Date] <> BLANK () )
) + 0

veasonfmsft_0-1655373400257.png

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
dkc
Frequent Visitor

thank you!

v-easonf-msft
Community Support
Community Support

Hi, @dkc 

Please try formula as below:

Max Contact Date= 
CALCULATE (
    MAX ( 'Contact list'[Contact Date] ),
    FILTER (
        'Contact list',
        'Contact list'[Customer] = MAX ( 'Promo list'[Customer] )
            && 'Contact list'[Contact Date] >= MAX ( 'Promo list'[Contact Start date] )
            && 'Contact list'[Contact Date] <= MIN ( 'Promo list'[Contact End date] )
    )
)
Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Promo list'[Customer] ),
    FILTER ( 'Promo list', [Max  Contact Date] <> BLANK () )
) + 0

veasonfmsft_0-1655373400257.png

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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