Forum Discussion

PowerAppUser's avatar
PowerAppUser
New Member
3 years ago
Solved

Need help with filtering data between two tables

Hi, I am trying to filter the data between two related tables but unable to achieve the desired output. Let me walkthru with a sample data so it will be easy to understand the problem statement. ...
  • Ghhousuddin's avatar
    Ghhousuddin
    3 years ago

    the current DAX expression only works for single month selections because it uses the SELECTEDVALUE function, which returns a blank when multiple values are selected in the slicer.

    To handle multiple month selections, you can modify the DAX expression as follows:

     

    Filtered TimeSaved =
    VAR SelectedMonths = VALUES(Table1[DeploymentDate])
    RETURN
    CALCULATE(
    SUM(Table2[TimeSaved]),
    FILTER(
    ALL(Table2),
    Table2[Date] IN SelectedMonths && RELATED(Table1[DeploymentDate]) IN SelectedMonths
    )
    )

     

    Explanation of the modified DAX measure:

    1. Replace SELECTEDVALUE with VALUES to store all selected months in the SelectedMonths variable, even when multiple months are selected.
    2. Replace the = operator with IN to check if the Table2[Date] and RELATED(Table1[DeploymentDate]) are in the set of SelectedMonths.

    Now the measure should work with multiple month selections in the DeploymentDate slicer. The "Filtered TimeSaved" measure will display the sum of TimeSaved for the processes deployed in the selected month(s).