Forum Discussion

Sharkybu's avatar
Sharkybu
Helper II
1 year ago
Solved

Visualization data changes when using count filtering

Hello again to the brilliant minds here.  This is an example to the table I have (I apologize for the spelling error, i built the file in a hurry) My needed parameters to filter: Before 2020...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Sharkybu 
    Thanks for reaching out to the Microsoft fabric community forum.

    Regarding the issue you raised, my solution is as follows:

    Based on my tests, the issue you are encountering is mainly due to the count aggregation method's calculation process not being directly affected by filters. In other words, when you use the aggregation method on a field, the filters will only determine whether the row values are displayed, but they will not affect the calculation result itself.

     

    If you want to get the desired result directly, I recommend using the following measure:

     

     

    MEASURE = 
    VAR cc1 =
        SELECTEDVALUE ( 'Table 2'[Facility] )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'Table'[ID] ),
            FILTER (
                'Table',
                'Table'[internal hire] = "Yes"
                    && CONTAINSSTRING ( 'Table'[Project facility], cc1 )
            )
        )

     

     

    The final result is as follows:

    Please note that my visual object does not have any filters set.

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.