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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jeebee
Regular Visitor

Cummulative Values as of the End of the month - Values can Increase or Decrease as well

I have a requirement where we need to plot the cummulative figures at a month level and the count at month level can increase/decrease because same users jump across statuses across time.

Sample Data:

User IDActive/Inactive FlagLast Modified TimestampLatest Record?
CP123Active20-Jan-21No
CP123Inactive21-Feb-22Yes
CP124Active20-Jan-21No
CP124Inactive5-Apr-22No
CP124Active7-Apr-22Yes
CP125Active6-Mar-21Yes
CP126Active20-Apr-21Yes
CP127Active4-Jun-21Yes
CP128Active19-Jul-21Yes
CP129Active2-Sep-21Yes
CP130Active17-Oct-21No
CP130Inactive1-Dec-21Yes
CP131Inactive20-Jan-21Yes
CP132Inactive20-Jan-21Yes
CP133Inactive20-Jan-21Yes
CP134Inactive20-Jan-21Yes
CP135Inactive20-Jan-21Yes
CP136Inactive7-Apr-22Yes
CP137Inactive8-Apr-22Yes
CP138Inactive9-Apr-22No
CP138Active9-Jun-22Yes

 

The ask is -

Chart to represent Active/Inactive Users count over time (Cummulative)

ex: How many Active/Inactive Users were present as of Jan-2022,Feb-2022 and so on...

Expected Output:

 Jan-22Feb-22Mar-22Apr-22May-22Jun-22
Active Users Total - Cummulative766667
Inactive Users Total - Cummulative67710109

 

Note: In above Output that values need to increase but it can also decrese when compared against the prevous month (Ex:  Active User count have reduced in Feb month compared to Jan month )

 

How to implement this?

2 REPLIES 2
jeebee
Regular Visitor

Thank you for the revert, but above is not what Im looking for. 

In the output that im expecting, the count can also "decrease" when compared with the earlier month, in above output shared the count only keeps on increasing month after month which is not what im looking for

 

Example:

Lets consider we  had 13 users (7 active and 6 inactive users) in total have  as of end January.

Among the 7 active users was User A who was having the status "Active" as of end January. Hence this was user was counted against Active users count for the month of January

The same User A, lets assume that his status changed to "Inactive" as of end February and in Feb month no new users got added to the system. Hence the final count expected is still 13 users (6 active and 7 inactive users) 

Note: Here the count of Active Users for Feb got reduced when compared against Jan and count of Inactive Users for Feb got increased when compared against Jan

 

Please let me know if the above explanation is not clear

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1667811222767.png

 

Jihwan_Kim_0-1667811166651.png

 

Users count active: = 
VAR _userstablerecentdate =
    SUMMARIZE (
        ADDCOLUMNS (
            SUMMARIZE (
                User,
                User[User ID],
                User[Active/Inactive Flag],
                User[Modified Timestamp]
            ),
            "@latestdate",
                CALCULATE (
                    MAXX (
                        FILTER ( User, User[Modified Timestamp] <= MAX ( 'Calendar'[Date] ) ),
                        User[Modified Timestamp]
                    )
                )
        ),
        User[User ID],
        [@latestdate]
    )
VAR _usercumulatetable =
    CALCULATETABLE (
        User,
        TREATAS ( _userstablerecentdate, User[User ID], User[Modified Timestamp] )
    )
RETURN
    COUNTROWS (
        FILTER ( _usercumulatetable, User[Active/Inactive Flag] = "Active" )
    )

 

Users count inactive: = 
VAR _userstablerecentdate =
    SUMMARIZE (
        ADDCOLUMNS (
            SUMMARIZE (
                User,
                User[User ID],
                User[Active/Inactive Flag],
                User[Modified Timestamp]
            ),
            "@latestdate",
                CALCULATE (
                    MAXX (
                        FILTER ( User, User[Modified Timestamp] <= MAX ( 'Calendar'[Date] ) ),
                        User[Modified Timestamp]
                    )
                )
        ),
        User[User ID],
        [@latestdate]
    )
VAR _usercumulatetable =
    CALCULATETABLE (
        User,
        TREATAS ( _userstablerecentdate, User[User ID], User[Modified Timestamp] )
    )
RETURN
    COUNTROWS (
        FILTER ( _usercumulatetable, User[Active/Inactive Flag] = "Inactive" )
    )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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