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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
amberebee
New Member

True/False indicator based on a measure?

Hi everyone,

 

I have tried searching and I don't think I have the right vocabulary to find just what I need, so I hope you can help me!

 

I have data like the attachment (well, I don't see anywhere to add an attachment, so I'll come right back after I post this). I have the following measure:

 

AbsRate = calculate(COUNT(table[DATE]), filter(table, table[Attendance]="Absent"))/calculate(COUNT(table[DATE]))

 

So, depending on the context, AbsRate would show the percentage of absences in an entire school, grade level, or individual student.

 

I need to figure out how many students (unique StudentID) have an AbsRate of 10% or higher. I might end up with 3 measures:

  • Total number of students = count unique studentID
  • Total number of students chronically absent = count unique studentID if absrate >=.10
  • Percentage chronically absent = total number of students chronically absent / total number of students.

Can anyone help me create these measures based on this data format?

5 REPLIES 5
amberebee
New Member

https://drive.google.com/file/d/1iK84pkUeAh7jBwEw7xWRiosgPoPnVdgx/view?usp=sharing 

 

OK, let's see if this works.

 

I apologize for not including the school variable in my initial question. I didn't realize it mattered. 

 

Here's what you will see in the linked report. AbsRate is calculating properly in the top table, but the # and % of students chronically absent does not vary by school the way I want. School A has 2 students, 67% chronically absent. School B has 3 students, 100% chronically absent.

 

It does seem like % chronically absent is fine, it's just the count of students chronically absent that is messing up the %. It's dividing 5 (number of chronically absent students in the whole division) by 3 (number of students in a particular school)

amberebee_1-1685970980004.png

 

amberebee
New Member

StudentIDDateAttendance
111111/1/2023Present
111111/2/2023Present
111111/3/2023Present
111111/4/2023Present
111111/5/2023Present
222221/6/2023Present
222221/7/2023Present
222221/8/2023Present
222221/9/2023Present
222221/10/2023Absent
333331/11/2023Present
333331/12/2023Present
333331/13/2023Absent
333331/14/2023Absent
333331/15/2023Absent

 

I don't think I can attach a file, so here's how the data look. Thanks!

Hello @amberebee

 

1. Total number of students (count unique StudentID):

 

Total number of students = DISTINCTCOUNT(table[StudentID])

 

2. Total number of students chronically absent (count unique StudentID if AbsRate >= 0.10):

 

Total number of students chronically absent =
CALCULATE(
    DISTINCTCOUNT(table[StudentID]),
    FILTER(ALL(table), [AbsRate] >= 0.10)
)

 

3. Percentage chronically absent (Total number of students chronically absent / Total number of students):

 

Percentage chronically absent = DIVIDE([Total number of students chronically absent], [Total number of students], 0)

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi Sahir,

Thanks so much for engaging with my question! Here is the outcome when I create the three measures you provided. Each row represents a different school. The number of students column is correct. I'm still trying to figure out what's going on with the other 2 columns, but roughly speaking, the number of students chronically absent in a school should range from about 8-30% of the total number of students. There's something off about the context of the measures that I haven't figured out yet.

 

amberebee_0-1685969367510.png

 

I replicated your measures in Power BI using the simpler example dataset, and they worked. I'm going to expand the simple dataset to also include different schools to see if I can better replicate the issue in my larger dataset. Stay tuned. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors