Forum Discussion

Jyaul1122's avatar
Jyaul1122
Helper III
1 year ago
Solved

Status based on score

Hi,

I have Student table( Student Name,Subject and Score) as the data below:

Student NameSubjectScore
Student1Subject150
Student1Subject267
Student1Subject350
Student1Subject430
Student1Subject580
Student2Subject166
Student2Subject294
Student2Subject322
Student2Subject433
Student2Subject545
Student3Subject175
Student3Subject280
Student3Subject355
Student3Subject484
Student3Subject565

 

Requirements: I would like to have Status Column(using DAX), if anyone of the subject have score less than 40 then status will be BAD for each row for that Student otherwise GOOD.

example:

Student NameSubjectScoreStatus - Calculated Column(DAX)
Student1Subject150BAD
Student1Subject267BAD
Student1Subject350BAD
Student1Subject430BAD
Student1Subject580BAD
Student2Subject166BAD
Student2Subject294BAD
Student2Subject322BAD
Student2Subject433BAD
Student2Subject545BAD
Student3Subject175GOOD
Student3Subject280GOOD
Student3Subject355GOOD
Student3Subject484GOOD
Student3Subject565GOOD

How can I achieve using DAX Calculated column (not a measure) ?

3 Replies

  • Hi Jyaul1122 ,


    You can achieve this using a calculated column with a combination of CALCULATE, FILTER, and MINX. Here's one way to do it:

    Status = 
    VAR CurrentStudent = 'Student'[Student Name]
    VAR MinScore = 
        CALCULATE(
            MINX(FILTER('Student', 'Student'[Student Name] = CurrentStudent), 'Student'[Score])
        )
    RETURN IF(MinScore < 40, "BAD", "GOOD")

    This logic checks the minimum score for each student across all their subjects. If it's below 40, it flags all rows for that student as "BAD", otherwise "GOOD".

    Let me know if your actual table structure is different or if you're using a different name for the table — this can be adjusted easily.

    If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

    *This response was supported by AI for translation and text editing purposes.

  • Hi Jyaul1122, Hope you are doing good !

    Please try the below dax to create calculated column:



    VAR name = [Student Name]
    RETURN
    IF(COUNTROWS(
    FILTER('Student table','Student table' [Student Name] = name && "Student table' [Score] <=40))>=1, "BAD", "GOOD")


    If this post helps to answer your question, please consider accepting it as a solution so others can find it more quickly when they face a similar challenge.


    Proud to be a Microsoft Fabric community super user


    Let's Connect on LinkedIn


    Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.