cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
sabry_303
Frequent Visitor

Cumulative count by month by type

Hey gurus,

 

I am attemting to create a measure to calculate the cumulative headcount by month. Would you please help?

 

My data:

Employee IDHire dateIdentity
101439292

1-Jul-

23

IFS
10142511118-Jun-23Tech Org
10142187018-Jun-23Tech Org
10142283018-Jun-23Tech Org
10142527718-Jun-23Tech Org

 

 

 

Target:

MonthIdentityCumulative
JuneIFS0
JuneTech Org4
JulyTech Org4
JulyIFS1
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @sabry_303 ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a dimension table

Identities = VALUES('Table'[Identity])

vyiruanmsft_1-1693193307995.png

2. Create a measure as below 

Cumulative = 
VAR _ide =
    SELECTEDVALUE ( 'Identities'[Identity] )
VAR _date =
    SELECTEDVALUE ( 'Table'[Hire date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Employee ID] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Identity] = _ide
                && 'Table'[Hire date] <= _date
        )
    ) + 0

3. Create a visual as below screenshot

vyiruanmsft_0-1693193218597.png

Best Regards

Community Support Team _ Rena
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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @sabry_303 ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a dimension table

Identities = VALUES('Table'[Identity])

vyiruanmsft_1-1693193307995.png

2. Create a measure as below 

Cumulative = 
VAR _ide =
    SELECTEDVALUE ( 'Identities'[Identity] )
VAR _date =
    SELECTEDVALUE ( 'Table'[Hire date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Employee ID] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Identity] = _ide
                && 'Table'[Hire date] <= _date
        )
    ) + 0

3. Create a visual as below screenshot

vyiruanmsft_0-1693193218597.png

Best Regards

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors