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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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