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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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])

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])

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors