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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
hpatel247
Helper I
Helper I

running totals count

Hi,

 

I'm trying to show a cumulative total count of users per month but not sure how to do this. So far i have managed to get close to it however in my data, i can have multiple users in the same month but it counts each row. e.g in April i have 8 rows but 6 unique users, in May i have 4 users all unique you the total i would expect to show in May would be 10 (6 + 4) and so on each month

 

I'm using the below measure:

 

RunningTotal = var rowdata = FTE[Month] return CALCULATE(SUM(FTE[MTD]),FILTER(FTE,FTE[Month]<=rowdata && YEAR(FTE[Month])=YEAR(rowdata)))

 

Can someone help me with this as i have tried different methods from posts that are out there but they all are based on total sales or costs etc but i need one similar but as a cumulative count and not double counting if that makes sense.

 

regards

 

Hetal

3 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Try the Running Total quick measure. You could potentially replace the SUM with COUNT for the aggregator. If you can post sample data could provide a more complete answer.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

p0nk
Frequent Visitor

I belive you are looking for a measure like this:

 

Running total of unique users per month = CALCULATE(DISTINCTCOUNT(TableName[UserColumn]), FILTER(ALL(TableName), TableName[Month] <= TableName[Month])))

 

More information on the data you are using would be helpful.

 

Hope this helps!

View solution in original post

Distinct users = CALCULATE(COUNT(Table_Name[User ID]), FILTER(ALL(Table_Name), Table_Name[Month] <= MAX(Table_Name[Month])), VALUES(Table_Name[Category]))

 

This measure will display a table like this:

example.PNG

To 'fill-in the gaps' as in your example I think you would have to use a calculated column which is more difficult (and I am unsure of). This will give you the same results but leave the cells blank if no change has occured. You may be able to find a way to fuill in these gaps.

 

Hope this helps!

View solution in original post

8 REPLIES 8
p0nk
Frequent Visitor

I belive you are looking for a measure like this:

 

Running total of unique users per month = CALCULATE(DISTINCTCOUNT(TableName[UserColumn]), FILTER(ALL(TableName), TableName[Month] <= TableName[Month])))

 

More information on the data you are using would be helpful.

 

Hope this helps!

Thanks for your response. I have replaced SUM with DISTINCTCOUNT and it works. However i now need to know how to count users more than once if they appear in 2 different categories.

 

I have tried using COUNT and COUNTA but still doesn't count the user in each category. Is there a way round this

 

regards

 

Hetal

I don't quite understand what you mean by different categorys? Are you able to post a sample of your data and an example of the result you want to achieve?

A Sample of what i want to achieve

 

This is my Data:

 

User IDCategoryMonth
1TriageApr-17
1Youth Conditional CautionApr-17
2TriageMay-17
2Youth CautionJul-17
3Youth Conditional CautionMay-17
3Youth CautionApr-17
4Youth CautionMay-17
5Youth Conditional CautionJun-17
6Youth Conditional CautionJun-17
7Youth CautionJul-17

 

So individual month totals per category should show as:

 

 Apr-17May-17Jun-17Jul-17
Triage1100
Youth Caution1102
Youth Conditional Caution1120

 

Therefore i want my running totals to show as:

 

Running TotalApr-17May-17Jun-17Jul-17
Triage1222
Youth Caution1224
Youth Conditional Caution1244

 

Hope this makes sense

 

regards

 

Hetal

Distinct users = CALCULATE(COUNT(Table_Name[User ID]), FILTER(ALL(Table_Name), Table_Name[Month] <= MAX(Table_Name[Month])), VALUES(Table_Name[Category]))

 

This measure will display a table like this:

example.PNG

To 'fill-in the gaps' as in your example I think you would have to use a calculated column which is more difficult (and I am unsure of). This will give you the same results but leave the cells blank if no change has occured. You may be able to find a way to fuill in these gaps.

 

Hope this helps!

Thank you for your response. It has worked but will play around to fill in the blanks

Anonymous
Not applicable

HI,

were you able to fill in the Blanks?

Greg_Deckler
Super User
Super User

Try the Running Total quick measure. You could potentially replace the SUM with COUNT for the aggregator. If you can post sample data could provide a more complete answer.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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