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
D_413
Regular Visitor

Attrition By Course and Fiscal Year

Hello,

 

I have an application query from a student data base and I'd like to calculate churn from fiscal year to fiscal year and returning program enrollment within a fiscal year. That date set looks like this:

 

FiscalYear ApplicationID StudentID Program Course

20151011AA1
20151022AA1
20162011BB1
20162023AA1
20162034AA1
20162044AA2
20173011CC1
20173025BB1

 

So I'd like to calculate both new and returning students for a fiscal year. Ex.

FiscalYear NewUnique ReturningUnique

201520
201621
201711

 

But also calculate that, for example, the unique invidividuals taking more than 1 course.

FiscalYear Program Took 1 Course Took 2 Courses

2016A11

 

 

I've been working with caluclated status column for year-to-year churn, but I admit to being stumped about what should be a simple count of Course.

 

Thanks for the help.

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

Hi @D_413,

 

Please refer to below formulas if it suitable for your requirement.

 

Calculate table formulas:

Analysis StudentID = 
SUMMARIZE (
    Records,
    [FiscalYear],
    "New Unique", COUNTROWS (
        EXCEPT (
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( Records, [FiscalYear] = EARLIER ( [FiscalYear] ) )
            ),
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( ALL ( Records ), [FiscalYear] < EARLIER ( Records[FiscalYear] ) )
            )
        )
    )
        + 0,
    "Returning Unique", COUNTROWS (
        INTERSECT (
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( ALL ( Records ), [FiscalYear] < EARLIER ( Records[FiscalYear] ) )
            ),
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( Records, [FiscalYear] <= EARLIER ( [FiscalYear] ) )
            )
        )
    )
        + 0
)

11.PNG

 

Analysis Course = 
SUMMARIZE (
    Records,
    [FiscalYear],
    [Program],
    "Unique Course", DISTINCTCOUNT ( Records[Course] )
)

12.PNG

 

Reference:

EXCEPT Function (DAX)

INTERSECT Function (DAX)

 

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

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @D_413,

 

Please refer to below formulas if it suitable for your requirement.

 

Calculate table formulas:

Analysis StudentID = 
SUMMARIZE (
    Records,
    [FiscalYear],
    "New Unique", COUNTROWS (
        EXCEPT (
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( Records, [FiscalYear] = EARLIER ( [FiscalYear] ) )
            ),
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( ALL ( Records ), [FiscalYear] < EARLIER ( Records[FiscalYear] ) )
            )
        )
    )
        + 0,
    "Returning Unique", COUNTROWS (
        INTERSECT (
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( ALL ( Records ), [FiscalYear] < EARLIER ( Records[FiscalYear] ) )
            ),
            CALCULATETABLE (
                VALUES ( Records[StudentID] ),
                FILTER ( Records, [FiscalYear] <= EARLIER ( [FiscalYear] ) )
            )
        )
    )
        + 0
)

11.PNG

 

Analysis Course = 
SUMMARIZE (
    Records,
    [FiscalYear],
    [Program],
    "Unique Course", DISTINCTCOUNT ( Records[Course] )
)

12.PNG

 

Reference:

EXCEPT Function (DAX)

INTERSECT Function (DAX)

 

Regards,

Xiaoxin Sheng

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

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.