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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
vehloaaron
Frequent Visitor

LASTNONBLANK Help

Hi Community - 

 

I am trying to write DAX that will return the name of a marketing campaign, where the date the person responded to the campaign is less than or equal to the date the opportunity was created.  The data is on seperate tables.

 

For my model I have three tables.  A 'Campaign Member' table that holds the marketing response data, a person table (w/ person ID), and a opportunity table.  

 

Here is what I have tried, however it is not pulling as expected.  Looking for some help.

 

Opportunity Create Campaign =
    CALCULATE(LASTNONBLANK('Campaign Member'[Campaign Name],TRUE()),
        FILTER('Campaign Member',
            'Campaign Member'[Person ID]==Opportunities[Person ID] &&
            'Campaign Member'[Responded]==TRUE() &&
            Opportunities[Opportunity Created Date] <= 'Campaign Member'[Campaign Member Association Date]))
 
I would expect the following
 
Some Big Deal 1 RETURN Some Marketing Campaign 4
Some Big Deal 2 RETURN Some Marketing Campaign 3
Some Big Deal 3 RETURN Some Marketing Campaign 3
 
Here is some screen shots of what the dax is returning incorrectly
 
Last Campaign before opportunity created.pngLast Campaign before opportunity created - Data Model.png
2 REPLIES 2
Anonymous
Not applicable

Hi @vehloaaron ,

 

Please try the following expression and if you still have problems, I think you can use the EARLIER function for grouping:

 

Opportunity Create Campaign =
CALCULATE(
    LASTNONBLANK('Campaign Member'[Campaign Name], TRUE()),
    FILTER(
        ALL('Campaign Member'),
        'Campaign Member'[Person ID] = Opportunities[Person ID] &&
        'Campaign Member'[Responded] = TRUE() &&
        Opportunities[Opportunity Created Date] <= 'Campaign Member'[Campaign Member Association Date]
    )
)

 

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

This is still returning the incorrect value, I tried grouping by earlier but that also didn't work.  

 

vehloaaron_0-1717163798108.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.