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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Calculate Running Count of Coached Employees By Category and Date

Hello All,

Below is the dataset that i am using.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdBLDkAwFIXhvdyxBLfdAPWW2EBjIEiM2P+MiaTEOWaNL43z13vJJRJ3TPO2LtcpjdNYE01kjLw4TCWmClONqcHUYuowZdeH4diBFlT737shKW5X3K64Qp9LAH0EBppTdVRLqg3Vluq71OBSQ1sMbTG0hfzUPp8X0MceS/dYuufW8QQ=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [EmployeeName_ID = _t, Coached_NonCoached = _t, Date = _t])
in
    Source

 

 

im trying to calculate the running count of employees who are coached.

As in above dataset, i have four months of data of employee's getting coached and non coached for each month and the total count of emp is 11.

In January, if a employee is Coached, he can be non coached in next month.

And if a employee is non coached in january, he can be coached in next coming any of the months.

 

Once a employee is coached, he will always be considered as coached.

 

So the output that i am expexting is as below.

 

Mohan128256_0-1625512858282.png

 

Any help or suggestions that how can i get this.

 

Thanks,

Mohan V.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

You can try to use the following measure formula to achieve your requirement:

Measure =
VAR currType =
    SELECTEDVALUE ( T1[Coached_NonCoached] )
VAR coached =
    CALCULATETABLE (
        VALUES ( T1[EmployeeName_ID] ),
        FILTER (
            ALLSELECTED ( T1 ),
            [Date] <= MAX ( T1[Date] )
                && [Coached_NonCoached] = "Coached"
        )
    )
VAR noncoached =
    CALCULATETABLE (
        VALUES ( T1[EmployeeName_ID] ),
        FILTER (
            ALLSELECTED ( T1 ),
            [Date] <= MAX ( T1[Date] )
                && [Coached_NonCoached] = "NonCoached"
        )
    )
RETURN
    SWITCH (
        currType,
        "Coached", CONCATENATEX ( coached, [EmployeeName_ID], "," ),
        "NonCoached", CONCATENATEX ( EXCEPT ( noncoached, coached ), [EmployeeName_ID], "," )
    )

8.png

Notice: power bi visuals will auto-hide blank rows, you can click on the category field and choose 'show item with not data' to force display these hide rows.
Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @Anonymous,

You can try to use the following measure formula to achieve your requirement:

Measure =
VAR currType =
    SELECTEDVALUE ( T1[Coached_NonCoached] )
VAR coached =
    CALCULATETABLE (
        VALUES ( T1[EmployeeName_ID] ),
        FILTER (
            ALLSELECTED ( T1 ),
            [Date] <= MAX ( T1[Date] )
                && [Coached_NonCoached] = "Coached"
        )
    )
VAR noncoached =
    CALCULATETABLE (
        VALUES ( T1[EmployeeName_ID] ),
        FILTER (
            ALLSELECTED ( T1 ),
            [Date] <= MAX ( T1[Date] )
                && [Coached_NonCoached] = "NonCoached"
        )
    )
RETURN
    SWITCH (
        currType,
        "Coached", CONCATENATEX ( coached, [EmployeeName_ID], "," ),
        "NonCoached", CONCATENATEX ( EXCEPT ( noncoached, coached ), [EmployeeName_ID], "," )
    )

8.png

Notice: power bi visuals will auto-hide blank rows, you can click on the category field and choose 'show item with not data' to force display these hide rows.
Regards,

Xiaoxin Sheng

Portrek
Resolver III
Resolver III

Hi Mohan.

 

You need to create two measures.

 

1º To count the Coached and NonCoached.

 

measure count coached =    COUNTROWS('table')

 

 

2º Concatenate the results

 

 

Measure Emps Include = CONCATENATEX('table'
,
'table'[EmployeeName_ID]
,
", "
)

 

 

After that, put the measures in the table visual.

 

Sem título22.png

 

 

Best Regards

 

 

Anonymous
Not applicable

Hi @Portrek  Thanks for the reply.

 

I guess my ask was misfired.

 

Employee's include is just for understanding purpose, which will give a idea how the count should be based on the coached employee's and what should be the value.

The Count column is what the output that i am expecting.

I would like to have running count of distinct Coached employees.

 

Please help.

 

Thanks,

Mohan V.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.