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
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
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.