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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
AlwaysAGooner
Helper I
Helper I

Cumulative count for each level by month

Hey wonderful ppl,

 

New Year Greetings.

 

Am in need to calculate cumulative count for each level by months. There are three levels in the data, namely 'A', 'B' and 'C', with 'A' being the lowest.

Need cumulative count for each of the aforementioned levels by month. Also, pls note that an ID can have two level during a month but must always be counted once and only for the Highest level achieved, for e.g. if an ID had level 'A' and level 'B' in January then this ID must only be counted for level 'B' and not for level 'A'.

AlwaysAGooner_0-1704272664574.png

 

3 REPLIES 3
AlwaysAGooner
Helper I
Helper I

Any more suggestions? Awaiting a working solution that gives the right result
Thanks

Anonymous
Not applicable

HI @AlwaysAGooner,

You can try to use the following measure formula if helps:

formula =
VAR cLevel =
    CALCULATETABLE (
        VALUES ( Table1[ID] ),
        FILTER ( ALLSELECTED ( Table1 ), Table1[Level] = "C" ),
        VALUES ( Table1[Date] )
    )
VAR bLevel =
    CALCULATETABLE (
        VALUES ( Table1[ID] ),
        FILTER ( ALLSELECTED ( Table1 ), Table1[Level] = "B" && NOT ( [ID] IN cLevel ) ),
        VALUES ( Table1[Date] )
    )
VAR aLevel =
    CALCULATETABLE (
        VALUES ( Table1[ID] ),
        FILTER (
            ALLSELECTED ( Table1 ),
            Table1[Level] = "A"
                && NOT ( [ID] IN UNION ( cLevel, bLevel ) )
        ),
        VALUES ( Table1[Date] )
    )
VAR currLevel =
    SELECTEDVALUE ( Table1[Level] )
RETURN
    SWITCH (
        currLevel,
        "A", COUNTROWS ( aLevel ),
        "B", COUNTROWS ( bLevel ),
        "C", COUNTROWS ( cLevel )
    )

Regards,

Xiaoxin Sheng

Thanks.

 

It doesn't give accurate results. For calculating cLevel, we cannot make sure that the id is not marked as A and B, hence there can be an overalp if there were any movers from cLevel to bLevel / aLevel during the time.
This means, anyone who once was at cLevel will be counted in cLevel. Hope this makes sense.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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