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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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