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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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 ?

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 ?

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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