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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Arioli_Chezhian
Helper II
Helper II

How to check the status of previous month status using DAX Measure

Hello,
Below shown is my data.

NameDateStatus
Emp 101-01-20231
Emp 201-01-20230
Emp 101-02-20230
Emp 201-02-20230
Emp 101-03-20230
Emp 201-03-20230
Emp 101-04-20230
Emp 201-04-20230
Emp 101-05-20230
Emp 201-05-20231
Emp 101-06-20230
Emp 201-06-20230


This data shows - Employee details month wise the status of the course completion from January to June. If status = 1, then it means they have completed the course. Status = 0 then it means they haven't completed the course.

Requirement:
"Have to show Month wise percentage of employee who completed the course". 

Point to Note:
Even though the data is shown month wise, if a employee completes the course in January then even the status = 0 in february and for other months the percentage status should be considered as completed. 

Example:
As per above data, how the output should be shown is:
Jan - 50%
Feb - 50%
Mar - 50%
Apr - 50%
May - 100%
June - 100%
The emp 1 completed the course in 1st month itself, so it should be considered for rest of the month. Emp 2 completed the course in May month, so from may month the percentage of course completion will be 100%.

Please advise the DAX measure  to achieve this requirement. @amitchandak 

2 REPLIES 2
danextian
Super User
Super User

Hi @Arioli_Chezhian ,

 

The formula will depend on whether you wan to the result as a measure or as a calculated column. Either way, you'll need to determine  first the  earliest date the status is complete. Try these

 

CALC COLUMN

Earliest Month Completed (Calc Column) = 
CALCULATE (
    MIN ( 'Table'[Date] ),
    FILTER (
        'Table',
        'Table'[Name] = EARLIER ( 'Table'[Name] )
            && 'Table'[Status] = 1
    )
)
Percentage (Calc Column) = 
VAR __complete =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            'Table',
            'Table'[Date] = EARLIER ( 'Table'[Date] )
                && 'Table'[Date] >= 'Table'[Earliest Month Completed (Calc Column)]
        )
    )
RETURN
    DIVIDE (
        __complete,
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', 'Table'[Date] = EARLIER ( 'Table'[Date] ) )
        )
    )

 

MEASURE

Earliest Month Completed (Measure) = 
CALCULATE (
    MIN ( 'Table'[Date] ),
    FILTER ( ALLEXCEPT ( 'Table', 'Table'[Name] ), 'Table'[Status] = 1 )
)
Percentage (Measure) = 
DIVIDE (
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( 'Table', 'Table'[Date] >= [Earliest Month Completed (Measure)] )
    ),
    COUNTROWS ( 'Table' )
)

danextian_0-1687414630570.png

Please see attached  pbix for the details





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
TomMartens
Super User
Super User

Hey @Arioli_Chezhian ,

 

to avoid complexity in the measure I create a new column "Status projected" using the below DAX statement:

Status projected = 
var currentEmployee = 'Table'[Name]
var currentStatus = 'Table'[Status]
var currentDate = 'Table'[Date]
var projectedStatus = 
    IF( currentStatus = 1
        , 1
        , var DateCompletedExists = 
            MINX(
                filter( 'Table' , 'Table'[Status] = 1 && 'Table'[Name] = currentEmployee && 'Table'[Date] < currentDate)
                , 'Table'[Date]
            )
        return
        IF( ISBLANK( DateCompletedExists) , 0 , 1)
    )
return
    projectedStatus

Basically, check if an employee has completed the course in the past, if yes it returns 1, otherwise 0. The next picture shows the result:
image.png
Then the measure becomes simple:

completed vs in-progress = 
DIVIDE(
    CALCULATE( COUNTROWS( 'Table' ) , 'Table'[Status projected] = 1 )
    , CALCULATE( COUNTROWS( 'Table' ) , ALL( 'Table'[Status] ) )
)

And the line chart:
image.png

Hopefully, this provides what you are looking for.

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors