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
EH-IBS
Frequent Visitor

Prefiltering table with VAR referencing to another table?

Hi all,

 

I have an AIRCRAFT table which contains data of when each aircraft starts and finishes operating for my company. If you notice, aircraft CCC starts operating later than AAA and BBB. This is where the challenge starts.

 

Table AIRCRAFTTable AIRCRAFT

I also have a UTILIZATION table which contains data of the flights each aircraft does each day. For simplicity, each aircraft (AAA, BBB and CCC) operates 1 FC (Flight Cycle) each day.

 

Table UTILIZATIONTable UTILIZATION

I now want to filter the UTILIZATION table dynamically to filter only the flights that my company has flown (ie: I have to discard the flights that aircraft CCC did NOT operate for my company). So in this example, I would have to discard the rows with aircraft CCC flying on dates 01/01/2019 to 04/01/2019, as I have marked in yellow on the UTILIZATION table.

 

How can I do this dynamically/automatically referring to the AIRCRAFT table with the START and END dates for each aircraft? I think I would have to use a VAR but can't figure out how to make it work. Any help is very much appreciated.

 

Thanks and regards!

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @EH-IBS 

Create relationship as below

4.png

 

Create calcuated columns in 'UTILIZATION' table

related_start = RELATED(AIRCRAFT[start])

related_start = RELATED(AIRCRAFT[start])

filter_column = IF([date]>=[related_start]&&[date]<=[related_end],1,0)

5.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then 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-juanli-msft
Community Support
Community Support

Hi @EH-IBS 

Create relationship as below

4.png

 

Create calcuated columns in 'UTILIZATION' table

related_start = RELATED(AIRCRAFT[start])

related_start = RELATED(AIRCRAFT[start])

filter_column = IF([date]>=[related_start]&&[date]<=[related_end],1,0)

5.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-juanli-msft,

 

Thank you very much for your prompt reply.

 

It's indeed a very simple solution but I hadn't come accross the RELATED formula.

 

I guess this might decrease performance as I'm adding two more calculated columns, but it seems to work perfectly. I will have to implement it in the real case but I don't think there should be any other problems rising from this.

 

Thanks again and regards!

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.