cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EH-IBS Frequent Visitor
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 AIRCRAFT.PNGTable 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 UTILIZATION2.PNGTable 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

Accepted Solutions
Community Support Team
Community Support Team

Re: Prefiltering table with VAR referencing to another table?

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
Community Support Team
Community Support Team

Re: Prefiltering table with VAR referencing to another table?

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

EH-IBS Frequent Visitor
Frequent Visitor

Re: Prefiltering table with VAR referencing to another table?

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
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 497 members 3,923 guests
Please welcome our newest community members: