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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
maf
Regular Visitor

Running Count

I've titled this Running Count rather than Running Total as I've seen plenty of examples that sum numerics to a given date.

 

I'd like to count rows to a date rather than sum values.

 

A good example would be Installs.  A row with a timestamp is added to the Installs table everytime someone installs an app (suprisingly).  So...

 

Mon 6 installs

Tue  10 installs

Wed 20 installs

 

would give Installs to date as...

 

Mon 6

Tues 16

Wed 36

 

Any ideas ?

11 REPLIES 11
TomMartens
Super User
Super User

Hey,

 

here is a little example

 

On the page YTD Variations you will find this measure

Cumulated Count Rows = 
CALCULATE(
 COUNTROWS('FactWithDates'),
 FILTER(
  ALL('Calendar'),
  'Calendar'[Date] <= MAX('FactWithDates'[Date]) &&
  'Calendar'[Year] = MAX('Calendar'[Year])
 )

 Here just the visible rows in the current FilterContext (introduced using CALCULATE()) are counted

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Appologies for my ignorance but I don't see any running count on that page.

Now it's there again, somehow I managed to not use the measure in the table viz



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Still can't see it

It seems there have been some upload issues, please try again

2017-07-22_15-52-44.png



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

I was being stupid !  Couldn't understand the numbers until I noticed that you were counting rows by year aswell, so it didn't look like I expected.  All is good now apart from when I try to apply it to my data I get..

 

"Function 'CALCULATE' is not allowed as part of calculated column DAX expressions on DirectQuery models."

 

Any ideas ?

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @maf,

 

Since you were fetching data in Direct Query mode, you should create a measure rather than calculated column. The error was prompted because you created a column using above formula in Direct Query mode.

 

Regards,
Yuliana Gu

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

Can you explain what I should put in the messure to get the same results please ?

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @maf,

 

You can refer to the DAX formula provided in TomMartens's first post.

 

Regards,
Yuliana Gu

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

I've tried using that in a measure but get

 

Function 'FILTER' is not supported in this context in DirectQuery mode. 😞

Hey,

 

check the following option

Using unrestricted DAX in DirectQueryMode.png

 

and turn it on, please be aware, that some calculations can slow down your query performance.



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors