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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need help on a DAX to obtain Cohort Start Date

Hi, 

 

I need to find the Cohort started month with the data look like this. The rank is the order of the month that the student is still studying with the center. I need to find the first month for each ENR ID (enrollment ID).

 

For example, in this case, I need all of the Cohort Started Month to be 2020-01-02 for this student.

 

BI forum ask.PNG

 

I really need help with this. Thank you!!!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try a column like

new column =

minx(filter(table, [enr id] =earlier([enr id])),[Month])

 

Similar stuff has been discussed here

https://youtu.be/Q1vPWmfI25o

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

d1.png

 

You may create a calculated column or a measure as below.

Calculated column:

Cohort Started Month = 
CALCULATE(
    MIN('Table'[Month]),
    FILTER(
        ALL('Table'),
        'Table'[ENR ID]=EARLIER('Table'[ENR ID])
    )
) 

 

Measure:

Cohort Started Month Measure = 
CALCULATE(
    MIN('Table'[Month]),
    FILTER(
        ALL('Table'),
        'Table'[ENR ID]=SELECTEDVALUE('Table'[ENR ID])
    )
) 

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

d1.png

 

You may create a calculated column or a measure as below.

Calculated column:

Cohort Started Month = 
CALCULATE(
    MIN('Table'[Month]),
    FILTER(
        ALL('Table'),
        'Table'[ENR ID]=EARLIER('Table'[ENR ID])
    )
) 

 

Measure:

Cohort Started Month Measure = 
CALCULATE(
    MIN('Table'[Month]),
    FILTER(
        ALL('Table'),
        'Table'[ENR ID]=SELECTEDVALUE('Table'[ENR ID])
    )
) 

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi guys,

Thank you so muchhh !!! They all worked perfectly 😍

amitchandak
Super User
Super User

@Anonymous , Try a column like

new column =

minx(filter(table, [enr id] =earlier([enr id])),[Month])

 

Similar stuff has been discussed here

https://youtu.be/Q1vPWmfI25o

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.