Forum Discussion

hashemalrifai's avatar
hashemalrifai
New Member
10 years ago
Solved

Apply filter on one column [Beginner]

Hi, I'm an absolute beginner, and I have to ask after so many attempts. 

Let's assume that I have simple [Schools] and [Students] tables. Each student has a boolean flag column [IsActive].

And I'm creating a clustered column chart with two values together which are: "Total Students" and "Total Active Students"

 

but I couldn't know how to use filters to filter only one column (e.g. the darker in the chart).

The "Report level filter" or "Page level filter" are applying to all data imported to this report. 

"Visual level filter"? it applies to the "count", doesn't work!

 

How could I achieve that? Thanks :) 

 

  • Hey, 

     

    maybe this?

     

    Total Active Students = CALCULATE(SUM(Students);Students[IsActive] = 1)

  • Anonymous's avatar
    Anonymous
    10 years ago

    hashemalrifai This should return only those students that are active.

    ActiveOnly = CALCULATE(SUM('Students'[IsActive]),FILTER('Students', 'Students'[IsActive]=1))

5 Replies

  • Hey, 

     

    maybe this?

     

    Total Active Students = CALCULATE(SUM(Students);Students[IsActive] = 1)

  • Select your visualization.

    Go to Fields section (icon with 3 columns , next to paintbrush)

    There from Values fields, remove the column

    • hashemalrifai's avatar
      hashemalrifai
      New Member

      Thanks, achinm45 for answering, but I really need to have two columns, one for all students, and the other for [active] students. 

      In other words, I need two chart columns: 

      The first: All students

      The seconds: All students WHERE IsActive = True

       

      Thanks, and I hope that I explained better :) 

      • Anonymous's avatar
        Anonymous
        Not applicable

        hashemalrifai This should return only those students that are active.

        ActiveOnly = CALCULATE(SUM('Students'[IsActive]),FILTER('Students', 'Students'[IsActive]=1))

  • Thanks matemusic and Anonymous :) 

    You both helped to write this script and it's working perfectly!  

    CALCULATE(COUNTROWS(Students);Students[IsActive]=1)