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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Penn
Resolver I
Resolver I

Create a mesure to check if all rows in one column has only one value

Hi all,

 

Here's a very simple example. There are 3 students, and there is a date filter on the report.

StudentCourseExam DateResult
S001MBA6011/08/2019Fail
S001MCS6015/09/2019Pass
S001MBA6077/09/2019Pass
S001MBA6049/09/2019Pass
S001MBA60521/10/2019Pending
S002MCS6077/08/2019Fail
S002MBA6058/09/2019Pass
S002MBA60323/10/2019Pending
S003MCS6015/08/2019Pass
S003MBA6077/09/2019Pass
S003MCS6037/09/2019Pass
S003MBA6058/09/2019Pass
S003MBA6059/10/2019Pass

 

I want to create a measure to count the students passed all courses within a certain time frame.

 

Say if the date filter in from Aug 2019 to Oct 2019, the result should be 1 as only Student S003 has passed all exams in this time frame. But if I adjust the filter to look at Sep 2019 only, the result should be 3 as all 3 students have passed all exams in September.

 

The measure that I wrote only works then I put it in a table with [Student] column in it. How can I return the value in a card?

Count All Pass = CALCULATE(DISTINCTCOUNT('Table'[Student]), FILTER(ALLEXCEPT('Table', 'Table'[Student]), AND(MAX('Table'[Result]) = "Pass", MIN('Table'[Result]) = "Pass")))

 

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Penn ,

You can try to use following measure formula if it suitable for your requirement:

 

Passed Student Count=
COUNTROWS (
    FILTER (
        SUMMARIZE (
            ALLSELECTED ( T3 ),
            [Student],
            "A Course", DISTINCTCOUNT ( T3[Course] ),//all courses
            "P Course", CALCULATE ( DISTINCTCOUNT ( T3[Course] ), T3[Result] = "Pass" )//passed courses
        ),
        [A Course] = [P Course]
    )
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Penn ,

You can try to use following measure formula if it suitable for your requirement:

 

Passed Student Count=
COUNTROWS (
    FILTER (
        SUMMARIZE (
            ALLSELECTED ( T3 ),
            [Student],
            "A Course", DISTINCTCOUNT ( T3[Course] ),//all courses
            "P Course", CALCULATE ( DISTINCTCOUNT ( T3[Course] ), T3[Result] = "Pass" )//passed courses
        ),
        [A Course] = [P Course]
    )
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

This is pure witchcraft! Thanks!

Penn
Resolver I
Resolver I

Still no clue

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.