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
new_pbi_user
Regular Visitor

Count of rows, after a filter is applied to a measure

I'm pulling my hair out here, and could really use a hand.

 

The situation is that I've got a table with one measure "attendance".  I've pasted a sample of the data below as well.

 

table.jpgattendance_measure.jpg

 

 

 

 

 

 

 

 

 

 

 

 

I can easily make a visualization, filtered where the attendance is less than or equal to .95:

 

Sample_Vis.jpg

 

 

You'll notice that the values in the visualization are filtered already, and what I want to do is to do a row count on that result as you see it, after the <= .95 filter has been applied.  What I want to do is create a table visualization that looks like this:

 

attendance  number of students

----------  ------------------

.95         2

.94         2

.93         1

.92         1

 

The trick really is to be able to "use" those measures in another visualization after they've been calculated and the filters applied.  I've been searching for many hours, much longer than I care to admit.  I could really use a hand here.

 

A sample of the raw data is below.  Thank you for your help in advance.

 

 

dataset.jpg

1 ACCEPTED SOLUTION

Hi @new_pbi_user,

 

Download my solution from here.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
vanessafvg
Super User
Super User

@new_pbi_user when you say use those measures, what is the issue with just placing the student count on the same visual - not quite understanding what you want to do?  or do you just want that value?

 

you can always create your attendance as a calculated column and then filter by it rather than creating it by a measure

 

 

 

total students less or equal to 95% =
CALCULATE ( SUM ( table[student] ), attendance <= 0.95 )

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Thank you for the reply.

 

Putting the student count on the same visual doesn't work the same way.  It is counting all the rows, no matter what the attendance is.  This is what it looks like, and it isn't what I want.

 

 

wrong_result.jpg

 

What I want to see is how many students have what attendance.  Two students have .95, two students have .94, etc.

 

Your suggestion to create a column out of attendance instead of a measure is a good one; it doesn't work but I don't understand what I'm doing wrong.  This is the column, same as the measure:

 

new_column.jpg

 

But when I put it in the visual, the visual puts the attendance_col equal to this 172.9, which I would have to dig in and figure out how it came up with that.  You may have a point, but I don't understand why it is doing what it is doing.

 

new_result.jpg

 

 

I will say to you these visuals and tests are good for learning, but ultimately I don't care, I just want to be able to count the number of students with the corresponding attendance.  I have to be missing something here, I must be.  This is a common thing to have to do with a measurement, I would think.

 

Thank you very much for looking at this question.  I'm very close to hanging this up and doing this with SSRS and dynamic querying from the database.  This type of thing is very easy to do with SQL and querying with each filter change.  I'm obviously missing something.

 

 

new_pbi_user
Regular Visitor

Absolutely, here it is.  Thank you a ton for looking at it.  You can download the pbix file from this link:

 

https://1drv.ms/f/s!AiiIadlG4mKmb0hbieh5e1DI910

 

 

Hi @new_pbi_user,

 

Download my solution from here.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Ashish, this isn't exactly what I had in mind but I can make use of it to make things work.  Thank you so much for your time and for posting it.  You have helped me out and taught me something as well.  Thank you again.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

 

Share the link from where i can download your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.