Forum Discussion
Counting ELA and MATH
- 6 years ago
or this version might be faster
Measure V2 = VAR tab0_ = FILTER ( Table1, Table1[Subject] IN { "MATH", "ELA" } ) RETURN SUMX ( tab0_, ( COUNTROWS ( FILTER ( tab0_, [ID] = EARLIER ( [ID] ) ) ) = 2 ) * ( 1 / 2 ) )Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi,
This should work:
NumberOfStudentsAbsentInELAAndMath =
var filterset = FILTER(PresenceStudents;PresenceStudents[Subject]="ELA" || PresenceStudents[Subject]="MATH")
var summaryset_ineiterclass = SUMMARIZE(filterset;PresenceStudents[ID])
var allstudents = SUMMARIZE(PresenceStudents;PresenceStudents[ID])
return
COUNTX(EXCEPT(allstudents;summaryset_ineiterclass);1)As can be seen here:
Power BI file is available here.
Please accept as solution if this is what you are looking for.
Kind regards,
Steve.
Hi syasmin25
1. Place Table1[School ID] in a table visual
2. Place this measure in the visual
Measure V1 =
COUNTROWS (
FILTER (
DISTINCT ( Table1[ID] ),
CALCULATE ( COUNT ( Table1[ID] ), Table1[Subject] IN { "ELA", "MATH" } ) = 2
)
) + 0
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- AlB6 years ago
Community Champion
or this version might be faster
Measure V2 = VAR tab0_ = FILTER ( Table1, Table1[Subject] IN { "MATH", "ELA" } ) RETURN SUMX ( tab0_, ( COUNTROWS ( FILTER ( tab0_, [ID] = EARLIER ( [ID] ) ) ) = 2 ) * ( 1 / 2 ) )Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- syasmin256 years ago
Helper V
I have tried your equationn, however it almost there yet not there with the result. Like my result for one of the schools is supposed to be 52 but witht he equation, it is still showing 60. I am guessing that it is carrying in duplicate values.