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
IF
Post Prodigy
Post Prodigy

Table result based on between dates

Hi,

I want to see the result as a table based on the selections from the slicers Table1[M_ID] and Table1[V_ID]. The result should be filtered based on Table1[A_Date] by checking in Table2. If the date of Table1[A_Date] is between the range of Table2[Start_Date] and Table2[End_Date], it should be listed in the table.

Table1

A_Date

M_ID

V_ID

7/17/2020

M23

V3435

7/17/2019

M34

V3422

6/17/2020

M22

V3222

 

Table2

Start_Date

End_Date

M_ID.1

S_ID

7/1/2020

8/1/2020

M23

S1435

7/17/2018

8/1/2020

M23

S1435

5/17/2019

5/10/2020

M22

S1222

5/1/2018

5/10/2020

M22

S1262

1/1/2018

7/10/2020

M22

S1312

5/1/2018

5/10/2019

M34

S1262

 

For example; if Table1[V_ID] is V3422, it shouldn't bring any result. Or if Table1[V_ID] is V3222, it should bring the row for S1222 and S1312.

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @IF 

try this,

create the measure, and put it into the visual level filter

filterMeasure = 
    var _selectMID=SELECTEDVALUE(Table1[M_ID])
    var _selectDate=SELECTEDVALUE(Table1[A_Date])
return 
    IF(MIN(Table2[Start_Date])<=_selectDate && MIN(Table2[End_Date])>=_selectDate && MIN(Table2[M_ID.1])=_selectMID,1,0)

vxiaotang_1-1634527895640.png

result

vxiaotang_0-1634527818655.pngvxiaotang_2-1634527918724.pngvxiaotang_3-1634527957841.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @IF 

try this,

create the measure, and put it into the visual level filter

filterMeasure = 
    var _selectMID=SELECTEDVALUE(Table1[M_ID])
    var _selectDate=SELECTEDVALUE(Table1[A_Date])
return 
    IF(MIN(Table2[Start_Date])<=_selectDate && MIN(Table2[End_Date])>=_selectDate && MIN(Table2[M_ID.1])=_selectMID,1,0)

vxiaotang_1-1634527895640.png

result

vxiaotang_0-1634527818655.pngvxiaotang_2-1634527918724.pngvxiaotang_3-1634527957841.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

smpa01
Super User
Super User

@IF  please try this as a measure

 

Measure =
VAR _0 =
    MAX ( 'Table 1'[A_Date] )
VAR _1 =
    CALCULATE (
        MAX ( 'Table 2'[M_ID.1] ),
        FILTER ( 'Table 2', _0 <= 'Table 2'[Start_Date] && 'Table 2'[End_Date] >= _0 )
    )
RETURN
    _1

 

smpa01_0-1634130247155.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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.