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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

IF Datesbetween

Hi,

 

I have this 2 tables (without connection), and a dimension date Table.

 

Table1

 

NameValueDate
Prod1220/02/2017
Prod2320/05/2017
Prod3420/08/2017
Prod1524/02/2017

 

 

Table 2

 

NameValueDate StartDate EndType
Prod1220/01/201725/02/2017C
Prod2320/04/201725/05/2017C
Prod3420/07/201725/08/2017C
Prod1524/01/201725/02/2017C1

 

How can I achieve this:

 

If Value, Name, and DatesBetween Start and End match with table1, then Type..

 

Like this:

 

NameValueDateType
Prod1220/02/2017C
Prod2320/05/2017C
Prod3420/08/2017C
Prod1524/02/2017C1

 

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@Anonymous

 

Hi, try with this measure:

 

Measure =
CALCULATE (
    FIRSTNONBLANK ( Table2[Type]; Table2[Type] ),
    FILTER (
        ALL ( Table2 ),
        Table2[Name] = SELECTEDVALUE ( Table1[Name] )
            && Table2[Value] = SELECTEDVALUE ( Table1[Value] )
            && Table2[Date End] >= SELECTEDVALUE ( Table1[Date] )
            && Table2[Date Start] <= SELECTEDVALUE ( Table1[Date] )
    )
)

Regards

 

Victor




Lima - Peru

View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

@Anonymous

 

Hi, try with this measure:

 

Measure =
CALCULATE (
    FIRSTNONBLANK ( Table2[Type]; Table2[Type] ),
    FILTER (
        ALL ( Table2 ),
        Table2[Name] = SELECTEDVALUE ( Table1[Name] )
            && Table2[Value] = SELECTEDVALUE ( Table1[Value] )
            && Table2[Date End] >= SELECTEDVALUE ( Table1[Date] )
            && Table2[Date Start] <= SELECTEDVALUE ( Table1[Date] )
    )
)

Regards

 

Victor




Lima - Peru
Anonymous
Not applicable

@Vvelarde,

 

It worked like a charm. Thank you!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.