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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Darko_Giac
Helper II
Helper II

Modified DAX Formula for Categorizing based on Date of Test Completion

Hi all,

 

I'm looking for a slight modification to a question I had earlier which I can't quite get to work.

 

 

I'm looking to create a calculated columns using DAX that will categorize students into one of 6 categories based on when they completed a test.

 

I would have to take into consideration the date as well as time (so if a student completed an array of tests on the same date, the time would determine into which category they fell)

 

I have attached a screenshot of sample data as well as the desired result which will (hopefully) be a clearer reference.

 

Any suggestions would be greatly appreciatedSampleWorkSheet1.pngDesiredResult.png

1 ACCEPTED SOLUTION

Hi @Darko_Giac

 

My apologies for late reply

 

After creating above column, you can create another column as follows to get GROUPINGS.

Please see the Power Pivot Model in attached Excel File

 

Group =
"Group " & RANKX ( Table1, [Notes],, DESC, DENSE )

Groy.png

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@Darko_Giac

 

Try this calculated Column

 

Notes =
VAR FirstClass =
    MINX (
        TOPN (
            1,
            FILTER ( Table1, [ParticipantID] = EARLIER ( [ParticipantID] ) ),
            [Assessment_end_date_time], ASC
        ),
        [Class]
    )
VAR SecondClass =
    MINX (
        TOPN (
            1,
            FILTER (
                Table1,
                [ParticipantID] = EARLIER ( [ParticipantID] )
                    && [Class] <> FirstClass
            ),
            [Assessment_end_date_time], ASC
        ),
        [Class]
    )
RETURN
    "Completed " & SecondClass
        & " after "
        & FirstClass

Thanks for this! 

 

How would I modify the syntax to categorize by groups instead of "Completed X after X".

 

For example, is there a way to change the label to "Group 1" for those that completed Q after V, "Group 2" for those that completed "NV after V", etc...

 

Thank you!


D.

Hi @Darko_Giac

 

My apologies for late reply

 

After creating above column, you can create another column as follows to get GROUPINGS.

Please see the Power Pivot Model in attached Excel File

 

Group =
"Group " & RANKX ( Table1, [Notes],, DESC, DENSE )

Groy.png

Perfect, thank you!

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.