Forum Discussion

NewbieQA's avatar
NewbieQA
Frequent Visitor
2 years ago
Solved

Search a specific table based on a value

Hello everyone, Im fairly new to Power BI and DAX but I have a challenge which im struggling with. Table example: Challenge is trying to get the "When" collumn dinamically searching the Spri...
  • mark_endicott's avatar
    2 years ago

    NewbieQA - Firstly you should add a project column to each sprint table, then append all of them together in Power Query, this will make the DAX much less complex. Here's some guidance on that: https://learn.microsoft.com/en-us/power-query/append-queries

     

    Once that is done, you can create a variable for the selected sprint, 

     

     

    VAR _project = SELECTEDVALUE( 'Sprint table'[Project] )

     

     

    and add that into your FILTER conditions:

     

     

    FILTER(
    'Sprint Table',
    AND(
    'Sprint table'[Start Date] <= __ClosureDate,
    __ClosureDate <= 'Sprint Table'[End Date], 'Sprint table'[Project] = _project
    )
    )

     

    You might need to change the 'Sprint table' for your 'Main table' columns in this filter code - depending on how your relationships are working. 

     

     

    If this works, please accept as the solution, it helps with visibility for others with the same challenge. 

  • mark_endicott's avatar
    mark_endicott
    2 years ago

    NewbieQA - Just change the filter argument to this:

     

     

    FILTER(
    'Sprint Table',
    'Sprint table'[Start Date] <= __ClosureDate &&
    __ClosureDate <= 'Sprint Table'[End Date] && 'Sprint table'[Project] = _project
    )

     

    If this works, please accept as the solution, it helps with visibility for others with the same challenge.