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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MarcelLandsky
Frequent Visitor

Calculated Column - Receive Value Based on Nearest Date

Hi, 

 

I'm trying to create a calculated column from a second table based on a date value. The goal is to display the actual level for each account before a campaign has been send. 

 

Levels

AccountIDPrevFunnelLvlNewFunnelLvlChangeDate
101-L102.01.2022
101L1L206.01.2022
101L2L310.01.2022
202L2L308.01.2022
202L4L512.01.2022

 

Campaign

AccountIDCampaignDateLvlonCampaignDate
10105.01.2022L1
10111.01.2022L3
20210.01.2022L3

 

Thanks in advance!

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @MarcelLandsky ,

 

Sorry for that the information you have provided is not making the problem clear to me. Could you please share more details to help us clarify your scenario?

Please provide us with more details about your table and your problem or share me with your pbix file after removing sensitive data.

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

Jos_Woolley
Solution Sage
Solution Sage

Perhaps post a new small example dataset and highlight the results from my formula which aren't correct.

Regards

Jos_Woolley
Solution Sage
Solution Sage

Hi,

I assume your two tables do not have a Many-to-Many relationship on the AccountID column?

Level on Campaign Date =
VAR AccountID = Campaign[AccountID]
VAR CampaignDate = Campaign[CampaignDate]
RETURN
    CALCULATE(
        MAX( 'Levels'[NewFunnelLevel] ),
        FILTER(
            'Levels',
            'Levels'[AccountID] = AccountID
                && 'Levels'[ChangeDate] <= CampaignDate
        )
    )

Regards

 

They do have an inactive many-to-many relationship but also connected via Account table. Sadly I didn't got %100 correct values on all rows.  

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.