Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Filtering a Graphic Based on Selected Value and Measure

Hello!

 

I have a "manager aid" dashboard that determines which employees from a roster are in a manager's reporting structure. Here is the DAX measure that makes that determination:

IsUnderSelectedManager =
VAR SelectedManager = SELECTEDVALUE(ManagerList[ManagerID])
RETURN
    IF (
        ISBLANK(SelectedManager),
        1,
        IF(
            (
                SELECTEDVALUE(Population[WT_L1_MGR_ID]) = SelectedManager ||
                SELECTEDVALUE(Population[WT_L2_MGR_ID]) = SelectedManager ||
                ...
            ),
            1,
            0
        )
    )

 

I have several different metrics with conditionals based on the measure (e.g. if=1, count) that are working fine. They display the count of employees under the manager. 

Unfortunately, this does not appropriately filter the population graphic. When I apply the filter, I get no results.

 

First, is there a way I can see the results of my tables and measures with a manager selected? That would help me troubleshoot.

Second, maybe somebody can tell me right away what's going on here. 

  • Hi Anonymous ,

     

    Your issue is that you're using a DAX measure (IsUnderSelectedManager) to determine if an employee falls under the selected manager, but you're expecting it to act like a filter on the population graphic. Measures calculate values but they don’t filter rows unless used inside visuals that support measure-based filters, like cards or conditional formatting. They don’t work for directly filtering a table visual unless explicitly used as a filter expression.

    The core problem is that SELECTEDVALUE() in your measure isn’t behaving as expected across rows. When used in a row context without a visual filter applied first, it often returns blank because multiple values exist. That’s why the population graphic shows nothing—it’s not getting a clean scalar value from the measure to evaluate against each row.

    To debug this, use a table visual and drag in the employee name, both manager ID columns, and your IsUnderSelectedManager measure. Then select a manager and look at which rows return 1 versus blank. You’ll probably see that it doesn’t work as expected because the measure isn't evaluating row by row with the right context.

    To fix this and make the filtering work as you intended, replace the measure with a calculated column like this:

    IsUnderSelectedManagerColumn =
    VAR SelectedManager = SELECTEDVALUE(ManagerList[ManagerID])
    RETURN
        IF (
            ISBLANK(SelectedManager),
            1,
            IF (
                Population[WT_L1_MGR_ID] = SelectedManager ||
                Population[WT_L2_MGR_ID] = SelectedManager,
                1,
                0
            )
        )
    

    This creates a column that reacts to the selection and can be used in visual-level filters. Note that SELECTEDVALUE inside a calculated column won’t be dynamic to slicers—because calculated columns are static once loaded—so this only works for simple, non-dynamic use cases.

    If you need it to remain dynamic and change based on slicer selections, keep the measure but redesign the visuals to support filtering through CALCULATE or use it as a filter inside another measure. For table visuals, create a virtual table that filters only relevant employees using CALCULATETABLE or FILTER, then display that table through a separate visual, not relying on filters applied to the main table visual.

    In short: measures calculate values, not filters. Calculated columns filter visuals but don’t respond to slicers. Choose one based on whether you want dynamic behavior or static filtering, and structure your visuals accordingly.

     

    Best regards,

4 Replies

  • Hi Anonymous ,

     

    Your issue is that you're using a DAX measure (IsUnderSelectedManager) to determine if an employee falls under the selected manager, but you're expecting it to act like a filter on the population graphic. Measures calculate values but they don’t filter rows unless used inside visuals that support measure-based filters, like cards or conditional formatting. They don’t work for directly filtering a table visual unless explicitly used as a filter expression.

    The core problem is that SELECTEDVALUE() in your measure isn’t behaving as expected across rows. When used in a row context without a visual filter applied first, it often returns blank because multiple values exist. That’s why the population graphic shows nothing—it’s not getting a clean scalar value from the measure to evaluate against each row.

    To debug this, use a table visual and drag in the employee name, both manager ID columns, and your IsUnderSelectedManager measure. Then select a manager and look at which rows return 1 versus blank. You’ll probably see that it doesn’t work as expected because the measure isn't evaluating row by row with the right context.

    To fix this and make the filtering work as you intended, replace the measure with a calculated column like this:

    IsUnderSelectedManagerColumn =
    VAR SelectedManager = SELECTEDVALUE(ManagerList[ManagerID])
    RETURN
        IF (
            ISBLANK(SelectedManager),
            1,
            IF (
                Population[WT_L1_MGR_ID] = SelectedManager ||
                Population[WT_L2_MGR_ID] = SelectedManager,
                1,
                0
            )
        )
    

    This creates a column that reacts to the selection and can be used in visual-level filters. Note that SELECTEDVALUE inside a calculated column won’t be dynamic to slicers—because calculated columns are static once loaded—so this only works for simple, non-dynamic use cases.

    If you need it to remain dynamic and change based on slicer selections, keep the measure but redesign the visuals to support filtering through CALCULATE or use it as a filter inside another measure. For table visuals, create a virtual table that filters only relevant employees using CALCULATETABLE or FILTER, then display that table through a separate visual, not relying on filters applied to the main table visual.

    In short: measures calculate values, not filters. Calculated columns filter visuals but don’t respond to slicers. Choose one based on whether you want dynamic behavior or static filtering, and structure your visuals accordingly.

     

    Best regards,

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 
    Thanks for reaching out to the Microsoft Fabric Community.


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


    Thank you.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

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

     

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi @llukens ,

     

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

     

    Thank you.