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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.