Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Data Match and Selection

Thank you upfront.

I have 2 tables already imported into PBI as below, wonder how to create a view to filter out records from Table 2 based on Table 1 that only with Direct Flight Avaliable? As a result, only the red line show up. 

 

Table 1:

Direct Flight List
FromTo
DallasNew York
AustinSeattle

 

Table 2:

Planned Trip List
NameMonthFromTo
TomFebHoustonNew York
FrankMarchDallasNew York
NateAugustAustinNew York
  • Hi Anonymous,
    Thank you for reaching out to the Microsoft Fabric Forum Community and thank you, kushanNa for sharing your valuable insights.

    I have reproduced your scenario using the DAX code provided by kushanNa. For your reference, I have attached the .pbix file.

    If this helps, then please “Accept it as a solution” and dropping a "Kudos" so other members can find it more easily.
    Hope this works for you!
    Thanks.

8 Replies

  • Hi,

    In Power Query, you can merge table 1 into table 2 based on 2 columns - From and To.  Thereafter just apply a filter.

  • Hi Anonymous 

     

    If you want to do this from Dax side please follow the following steps 

     

    click on modeling new table 

     

     

    copy and past the following code to create a Dax calculated table

     

    FilteredTrips = 
    FILTER(
        'Planned Trip List',
        LOOKUPVALUE(
            'Direct Flight List'[To], 
            'Direct Flight List'[From], 'Planned Trip List'[From], 
            'Direct Flight List'[To], 'Planned Trip List'[To]
        ) <> BLANK()
    )

     

    you can see the table on the Table view 

     

     

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi Anonymous,
    Thank you for reaching out to the Microsoft Fabric Forum Community and thank you, kushanNa for sharing your valuable insights.

    I have reproduced your scenario using the DAX code provided by kushanNa. For your reference, I have attached the .pbix file.

    If this helps, then please “Accept it as a solution” and dropping a "Kudos" so other members can find it more easily.
    Hope this works for you!
    Thanks.

    • v-ssriganesh's avatar
      v-ssriganesh
      Community Support

      Hi Anonymous,
      I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.
      Thank you.

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi Anonymous,

    May I ask if you have resolved this issue? If so, please mark it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi Anonymous,
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • Deku's avatar
    Deku
    Super User

    Add a table visual with table 2 fields. Then add the following measure to the filter pane and filter not is blank.

     

    var trip = SUMMARIZE( table2, table2[from], table2[to] )
    var matchingFlight =
       CALCULATETABLE(
          table1,
          TREATAS( trip, table1[from], table2[to] )
       )
    return
    IF( NOT ISEMPTY( matchingFlight ), 1 )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you but I didn't get it "Then add the following measure to the filter pane and filter not is blank." how to do this?