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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
fredsp
Frequent Visitor

Cumulative values - Sum of -> Count of with Strings

Hi,

 

I have a data set of issues reported in a project in Jira and I'm extracting Created Date and each Key (a unique number for each issues reported). I plot Count of Keys with Created Date to get a graph on how many issues are created each day, however now my problem.

 

I would also like to plot the cumulative value for each Created Date but since Key-value is a string I run into problem with my DAX-function.

Anyone out there who knows how to do a SUM of Count of per Created Date so that I can plot the cumulative values instead?

 

Br,

Fredrik

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @fredsp 
Here is a solution for your problem using example date. 
Please mark as accepted if it solves your problem 🙂

You want plot cumulative count (of distinct distinct keys) pr date.

Here is a solution for computing cumulative distinct counts pr date:

0) Generate sample data

Jira = 
DATATABLE (
    "Key", STRING, 
    "Created DateTime", DATETIME,
    {
        { "1", "2022-01-01 00:00:00" },
        { "2", "2022-01-01 12:34:56" },
        { "3", "2022-01-01 23:59:59" },
        { "4", "2022-01-02 07:00:00" },
        { "5", "2022-01-02 14:30:45" },
        { "6", "2022-01-03 20:15:30" },
        { "7", "2022-01-03 11:11:11" },
        { "8", "2022-01-04 18:45:22" },
        { "9", "2022-01-05 02:22:33" },
        { "10", "2022-01-6 15:55:44" }
    }
)


Add column Created Date with date part of DateTime column:

Created Date = DATE(
    YEAR(Jira[Created DateTime]),
    MONTH(Jira[Created DateTime]),
    DAY(Jira[Created DateTime])
)


See snippet below:

cosm_0-1687422330036.png

 


1) Create a summarized table with count pr date:
In Power BI Model Pane, select "New Table" and add the following DAX statement:

Count pr created date = SUMMARIZE(
Jira,
Jira[Created Date],
"Distinct keys", DISTINCTCOUNT(Jira[Key])
)

 
2) Add cumulative count as ameasure:

Cumulative Count = 
CALCULATE (
    SUM ( 'Count pr created date'[DISTINCT KEYS]),
    FILTER ( ALL ( 'Count pr created date' ), 
    'Count pr created date'[Created date] <= MAX
     ( 'Count pr created date'[Created date] ) )
)

 

cosm_1-1687422514698.png

cosm_2-1687422530757.png

( Filter statement includes all row less than or equal to maximum created date in current filter context)

Done 😀

Now you can use your measure to plot cumulative count as shown below:

cosm_3-1687422792676.png

 




Kind regards!

View solution in original post

4 REPLIES 4
fredsp
Frequent Visitor

Once again, thanks a lot!!

 

fredsp_1-1687436328699.png

 

fredsp
Frequent Visitor

Thanks a lot @Anonymous for your support. I'll try this out 😊

Anonymous
Not applicable

Nice - let me now if you run into trouble.

Please mark as solution if the solution solves your problem.

Kudos also appreciated.

Anonymous
Not applicable

Hi @fredsp 
Here is a solution for your problem using example date. 
Please mark as accepted if it solves your problem 🙂

You want plot cumulative count (of distinct distinct keys) pr date.

Here is a solution for computing cumulative distinct counts pr date:

0) Generate sample data

Jira = 
DATATABLE (
    "Key", STRING, 
    "Created DateTime", DATETIME,
    {
        { "1", "2022-01-01 00:00:00" },
        { "2", "2022-01-01 12:34:56" },
        { "3", "2022-01-01 23:59:59" },
        { "4", "2022-01-02 07:00:00" },
        { "5", "2022-01-02 14:30:45" },
        { "6", "2022-01-03 20:15:30" },
        { "7", "2022-01-03 11:11:11" },
        { "8", "2022-01-04 18:45:22" },
        { "9", "2022-01-05 02:22:33" },
        { "10", "2022-01-6 15:55:44" }
    }
)


Add column Created Date with date part of DateTime column:

Created Date = DATE(
    YEAR(Jira[Created DateTime]),
    MONTH(Jira[Created DateTime]),
    DAY(Jira[Created DateTime])
)


See snippet below:

cosm_0-1687422330036.png

 


1) Create a summarized table with count pr date:
In Power BI Model Pane, select "New Table" and add the following DAX statement:

Count pr created date = SUMMARIZE(
Jira,
Jira[Created Date],
"Distinct keys", DISTINCTCOUNT(Jira[Key])
)

 
2) Add cumulative count as ameasure:

Cumulative Count = 
CALCULATE (
    SUM ( 'Count pr created date'[DISTINCT KEYS]),
    FILTER ( ALL ( 'Count pr created date' ), 
    'Count pr created date'[Created date] <= MAX
     ( 'Count pr created date'[Created date] ) )
)

 

cosm_1-1687422514698.png

cosm_2-1687422530757.png

( Filter statement includes all row less than or equal to maximum created date in current filter context)

Done 😀

Now you can use your measure to plot cumulative count as shown below:

cosm_3-1687422792676.png

 




Kind regards!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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