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

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

Reply
AndyT9
Regular Visitor

Conditional Column using dates and separate table

Hello there

 

New to PowerBI and trying to pick it up as a go along building a dashboard that will save me time every day.

 

I am trying to create a new column in my main data table that is based on a date and matching it to values in a different table.

 

For example:

 

Machine usage

Users PINDate of use
246802/10/2017
246820/01/2018
309805/02/2018
256815/01/2018
256820/01/2018

 

Subscription history

 

Users PINSubscriptionSubscription Start dateSubscription End Date
2468Bronze01/10/201725/11/2017
2468Silver25/11/201715/01/2018
2468Gold15/01/201815/01/2019
3098Gold20/10/201702/02/2018
3098Bronze02/02/201802/02/2019
2568Silver01/01/201810/01/2018
2568Bronze10/01/201810/01/2019

 

What I am looking to do is to add to the machine usage table the details of the subscription that was active at the time of use, eg:

 

Users PINDate of useSubscriptionSubscription Start dateSubscription End Date
246802/10/2017Bronze01/10/201725/11/2017
246820/01/2018Gold15/01/201815/01/2019
309805/02/2018Bronze02/02/201802/02/2019
256815/01/2018Bronze10/01/201810/01/2019
256820/01/2018Bronze10/01/201810/01/2019

 

I am going to carry on reading and watching training videos - but right now I am not sure where and how best to achieve this.

 

Many thanks in advance.

 

Andy

1 ACCEPTED SOLUTION

@AndyT9

 

You can use the same pattern as above to get the other columns you want for example

 

Subscription Start Date =
CALCULATE (
    FIRSTNONBLANK ( SubscriptionHistory[Subscription Start date], 1 ),
    FILTER (
        SubscriptionHistory,
        MachineUsage[Users PIN] = SubscriptionHistory[Users PIN]
            && MachineUsage[Date of use] >= SubscriptionHistory[Subscription Start date]
            && MachineUsage[Date of use] <= SubscriptionHistory[Subscription End Date]
    )
)

View solution in original post

3 REPLIES 3
AndyT9
Regular Visitor

Hi @Zubair_Muhammad

 

That looks to do exactly what I wanted, thank you for your help. Now  I am going to spend an hour making sure I understand how this works 🙂

 

Thanks

Andy

Zubair_Muhammad
Community Champion
Community Champion

Hi @AndyT9

 

Try this Calculated Column....

 

Subscription =
CALCULATE (
    FIRSTNONBLANK ( SubscriptionHistory[Subscription], 1 ),
    FILTER (
        SubscriptionHistory,
        MachineUsage[Users PIN] = SubscriptionHistory[Users PIN]
            && MachineUsage[Date of use] >= SubscriptionHistory[Subscription Start date]
            && MachineUsage[Date of use] <= SubscriptionHistory[Subscription End Date]
    )
)

@AndyT9

 

You can use the same pattern as above to get the other columns you want for example

 

Subscription Start Date =
CALCULATE (
    FIRSTNONBLANK ( SubscriptionHistory[Subscription Start date], 1 ),
    FILTER (
        SubscriptionHistory,
        MachineUsage[Users PIN] = SubscriptionHistory[Users PIN]
            && MachineUsage[Date of use] >= SubscriptionHistory[Subscription Start date]
            && MachineUsage[Date of use] <= SubscriptionHistory[Subscription End Date]
    )
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.