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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
DionTN
Helper II
Helper II

Add column based on double filter

I have two tables like this: 

CompanyStartDateEndDateRegio
a01/01/202008/08/2020Demo
b01/01/202008/08/2020Demo
c01/01/202008/08/2020Demo
d01/01/202008/08/2020Demo
d08/01/202008/10/2020Live
d10/10/202001/12/2020Test
e01/01/202008/08/2020Demo
f01/01/202008/08/2020Demo
g01/01/202008/08/2020Demo

 

CompanyLoginDateregio
a02/01/2020demo
a03/01/2020demo
b04/01/2020demo
b05/01/2020demo
c06/01/2020demo
c07/01/2020demo
d11/11/2020test
d09/01/2020demo
d10/01/2020demo
e11/01/2020demo

 

I need to add the regio in the second table by a double filter in the first table. 

So I need to check the company and if the LoginDate is between start and end time. If so add regio to the second table. 

 

How can i write the function in add column? 

1 ACCEPTED SOLUTION
coskuersanli
Resolver III
Resolver III

Hi @DionTN 

 

Can you try as below please?

Column = 

CALCULATE
    (
        SELECTEDVALUE(Table1[Regio]),
        FILTER
            (
                Table1,
                Table1[Company] = Table2[Company] &&
                Table1[StartDate] <= Table2[LoginDate] &&
                Table1[EndDate] >= Table2[LoginDate]
            )
    )

 

coskuersanli_0-1661281409346.png

 

View solution in original post

1 REPLY 1
coskuersanli
Resolver III
Resolver III

Hi @DionTN 

 

Can you try as below please?

Column = 

CALCULATE
    (
        SELECTEDVALUE(Table1[Regio]),
        FILTER
            (
                Table1,
                Table1[Company] = Table2[Company] &&
                Table1[StartDate] <= Table2[LoginDate] &&
                Table1[EndDate] >= Table2[LoginDate]
            )
    )

 

coskuersanli_0-1661281409346.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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