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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.