Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Measure based on report level filter

Hi all, relatively new to Power BI but familiar with DAX. I am trying to create some logic to check and see if a slicer or a report level filtered value matches a value in one or another columns in ...
  • d_gosbell's avatar
    7 years ago

    To achieve this you will need a new table that has a distinct list of all names from both the owner and manager tables.

     

    You can do this by creating a calcuated table with the following code

    Person = DISTINCT(UNION(DISTINCT('Table'[Account Owner]),DISTINCT('Table'[Account Owner])))

    Note: I would rename the "Account Owner" column in this table after you've created it to something like "Person Name" 

     

    Then you could create a slicer on this new table and create a measure like the following which will do the OR filter on either column. Then when ever you using this measure with the Person Name slicer it will filter on both Owner and Manager names.

     

    Total Sales = 
    CALCULATE( 
       SUM('Table'[Sales]), 
       FILTER(ALL('Table'[Account Owner],'Table'[Manager Name]), 
           'Table'[Account Owner] in values(Person[Person Name]) 
            || 'Table'[Manager Name] in VALUES(Person[Person Name])
       )
    )