Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Having tried a few of the solutions posted around the web, I can't seem to figure out how to calculate a simple cumulative count.
In Excel, this would simply look like: =countif(A:A,"<="&date(2015,1,31)
The end result would provide a cumulative count as each month comes along.
However in my PowerBI model, there's a table with the 'account_creation_date' and another table acting as a master date table 'all_dates'. No relationship between the two since that would create some challenges.
So the question is how to create a formula that looks at ALL rows in the 'account' table and returns the cumulative count for that date where 'account_creation_date' = 'all_date'?
Solved! Go to Solution.
See if this works. You just need to change the [Date] columns to the correct name of the date columns in your model.
Cumulative Count = CALCULATE(COUNTROWS('account_creation_date'), FILTER('account_creation_date', 'account_creation_date'[Date] <= MAX('all_dates'[Date])))
The equation would also have to change if you ended up creating a relationship between the 'account_creation_date' and 'all_dates' table.
See if this works. You just need to change the [Date] columns to the correct name of the date columns in your model.
Cumulative Count = CALCULATE(COUNTROWS('account_creation_date'), FILTER('account_creation_date', 'account_creation_date'[Date] <= MAX('all_dates'[Date])))
The equation would also have to change if you ended up creating a relationship between the 'account_creation_date' and 'all_dates' table.
Hi @Twan - I've also used this solution successfully, but please can you elaborate on how I'd need to change the measure if I have a relationship between the 'account_creation_date' and 'all_dates' table? I had a relationship which made some of my other visualisations work well, but stopped your formula working. If i deactivated the relationship, your formula worked well, but my other charts are now broken....
Many thanks.
If you have a relationship between 'account_creation_date'[Date] and 'all_dates'[Date] then the formula should look like the below equation. Also, DAX Patterns has a good summary of how this type of measure works.
Cumulative Count = CALCULATE( COUNTROWS('account_creation_date'), FILTER( ALL('all_dates'[Date]), 'all_dates'[Date] <= MAX( 'all_dates'[Date] ) ) )
That worked - thanks! I realized that there was another filter that I needed to append as well which solved the issue.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |