Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
hashemalrifai
New Member

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"

 

delll.PNG

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 🙂 

 

2 ACCEPTED SOLUTIONS
matemusic
Advocate III
Advocate III

Hey, 

 

maybe this?

 

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

View solution in original post

@hashemalrifai This should return only those students that are active.

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


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

5 REPLIES 5
hashemalrifai
New Member

Thanks @matemusic and @Seth_C_Bauer 🙂 

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

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

 

matemusic
Advocate III
Advocate III

Hey, 

 

maybe this?

 

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

achinm45
Advocate IV
Advocate IV

Select your visualization.

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

There from Values fields, remove the column

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 🙂 

@hashemalrifai This should return only those students that are active.

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


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors