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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

filtering with unconnected table

Hi all

I need to make my calculated colomn filter on valid_from and valid_to in a unrelated tabel. My plan was to add datesbetween after value_id filter, to retrive correct value to correct dateperiod. but this doesen´t work

 

Any ides?

 


tabel1 this is my goal.

some_stuff  date some_value     calculated colomn (code below)
a2020100110100
b2020100110150
b2020110110100

 

table2 the other table

valid_from      valid_to     value_id  some_value
2020100120991231110
2020100120201031215
2020110120991231210

 

calculated colomn =
'tabel1'[somevalue]
     * SWITCH (
           TRUE (),
           'tabel1'[some_stuff] = "a",
               CALCULATE (
                     MIN ( 'table2'[somevalue] ),
                     'table2'[value_id] = 1
               ),
               'tabel1'[some_stuff] = "b",
            CALCULATE (
            MIN ( 'table2'[somevalue] ),
             'table2'[value_id] = 2,
          )
)

 

 

BG

/Måns

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column like this in table 1

 

maxx(filter(table2, ((Table1[some_stuff] ="a" && table2[value_id] = 1) || ( Table1[some_stuff] ="b" && table2[value_id] = 1 ))
&& Table1[date] >= Table2[valid_from] && Table1[date] <= Table2[valid_to] ), Table2[some_value])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try a new column like this in table 1

 

maxx(filter(table2, ((Table1[some_stuff] ="a" && table2[value_id] = 1) || ( Table1[some_stuff] ="b" && table2[value_id] = 1 ))
&& Table1[date] >= Table2[valid_from] && Table1[date] <= Table2[valid_to] ), Table2[some_value])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

That did it : )
thanks a bunch @amitchandak 

Anonymous
Not applicable

For the sake of clearity.

table 1 col date has 8 digits, cant get the col some_value to respect col dates space. I guess col some_value realy want´s a date : )

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.