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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.