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
arpost
Post Prodigy
Post Prodigy

How can I do a running total and categorize in a measure?

Greetings, all! I'm attempting to calculate a running total for a disconnected table and am hoping someone can help me out. Here's a sample scenario. 

 

Let's say I have the following tables (model below):

  1. Calendar (standard date table)
  2. Events (list of dates/people/miscellaneous other columns)
  3. Categories (disconnected table with a list of categories that are applied based on business logic)

arpost_0-1670443893533.png

 

I'm wanting to get a running total/count of the Events table and then "categorize" them dynamically.

 

DatePersonEventType
10/1/2022Max JonesWebinar
10/1/2022John SmithWebinar
10/1/2022Jane DoeWebinar
10/2/2022Jane DoeWebinar
10/3/2022Matthew HicksWebinar
10/3/2022Margaret JohnsonConference
10/3/2022Regina OrtizConference
11/13/2022Max JonesWebinar
11/13/2022John SmithConference
12/1/2022Jane DoeWebinar
12/1/2022Max JonesConference
12/1/2022John SmithConference
12/5/2022John SmithConference

 

The Category table has the following values:

 

OrderValue
1High
2Medium
3Low

 

I need to get a "subtotal" count of the events and then apply a "category" to them using the following logic:

 

 

SWITCH(true, {RunningTotalEventCount} >= 4, "High", {RunningTotalEventCount} >= 2, "Medium", "Low")​

 

 

I then want to show this in a visual like the following:

 

arpost_2-1670443426188.png

 

The issue is ALL of this needs to be done in a measure because it needs to change when a person slices/dices. Been working on this for a few hours and am about near my wit's end.

 

Hope all of this made sense. Appreciate it!

1 REPLY 1
Anonymous
Not applicable

Hi @arpost ,

I have created a simple smaple, please refer to it to see if it helps you.

Create a column first.

month = MONTH('Table'[Date])

Then create  a measure.

Measure = var _1=
CALCULATE(COUNT('Table'[EventType]),FILTER(ALL('Table'),'Table'[EventType]=SELECTEDVALUE('Table'[EventType])&&'Table'[month]=SELECTEDVALUE('Table'[month])))
return
IF( _1>= 4, "High",IF(_1>= 2, "Medium", "Low"))

Or a column.

Column = var _1=
CALCULATE(COUNT('Table'[EventType]),FILTER(ALL('Table'),'Table'[EventType]=EARLIER('Table'[EventType])&&'Table'[month]=EARLIER('Table'[month])))
return
IF( _1>= 4, "High",IF(_1>= 2, "Medium", "Low"))

vpollymsft_0-1670467663860.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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