cancel
Showing results for
Did you mean:
Regular Visitor

## Aggregates of counts over time

Hi

I am still quite new to power BI and working as a BI analyst so please bare with me 🙂

The data that I am trying to work with is numeric.

Each item has what is called a work item ID (used to uniquely identify each work item) and a corresponding event time.

(there can be multiple line items with the same work item ID as the instruction moves through different queues).

The work item ID is a string of intergers ie: 3707193.

I am trying to calculate the average amount of instructions being created per hour.

It is easy to measure the totals as I can just plot my create date against the distinct count of work item IDs.

BUT when I try select average/median/etc it tries to give me the average my summed work item IDs.

For example, I get 3 instructions on Monday (week 1), 5 on Monday (week 2) and 12 on Monday (week 3).

My average should be 6.67 recurring.

But when I select average on power BI I get a massive number because it is summing the actual numbers given to each work item ID.

I need to find a way where I can aggregate counts only....

I've tried creating columns and measures of distinct (work item id) etc but all of my results are returning incorrect figures.

My ultimate goal is to show averages and medians of new instructions created by the hour as to measure head count needed to process those instructions.

Any ideas/advice will be greatly appreciated!

Thanks 🙂

1 ACCEPTED SOLUTION
Community Support

Hi @MichaelK,

>>So I would like to calculate how the average moves through out the day

You can add a slicer to get the average moves through out the day.

Slicer:

Line chart:

Use slicer to filter the result of specify hour daily movement.

>>And then how that average changes from 11am to 12pm, 12pm - 1pm etc.

You can use below measure to see the hourly movement:

Average of hour:

Avg Hour = AVERAGEX(FILTER(all(Sheet1), Sheet1[Hour]=max(Sheet1[Hour])),[Hourly Count])

Notice: the hour means the hour:00~hour:59:59.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
5 REPLIES 5
Community Support

Hi @MichaelK,

According to your description, you want to get the average and middle of weekly count,right?

You can refer to below sample:

Source table:

Measures:

Count of same date and hour:

Hourly Count = COUNTAX(FILTER(ALL(Sheet1), FORMAT([Date],"MM/dd/yyyy HH")=FORMAT(MAX([Date]),"MM/dd/yyyy HH")),[Work Item ID])

Count of same week and hour:

Weekly Count = COUNTAX(FILTER(ALL(Sheet1),WEEKNUM(Sheet1[Date])=WEEKNUM(MAX([Date]))&&HOUR([Date])=HOUR(MAX([Date]))),[Work Item ID])

Avg Week = AVERAGEX(ALL(Sheet1),[Weekly Count])

Med Week = MEDIANX(ALL(Sheet1),[Weekly Count])

Create a table visual to show the result:

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Regular Visitor

Power BI does not let me aggregate the measure.

I create a new measure named hourly count and when I try create a measure to aggregate it, the measure does not appear in the predictive text. When the measure is typed in manually it gives me an error.

Also I'm not sure if what you provided is what I am trying to go for.

What I actually want is a moving average and moving median.

To further explain our data, I only want to be working with WORK_ITEM_ID and CREATE_DATE at the moment.

I have extracted the hours of the day from CREATE_DATTE.

I have then plotted the hours of the day against distinct count of WORK_ITEM_ID.

This has given me the total amount of WORK_ITEM_ID received per hour.

Bevcause our data goes back about a year, for example, between 10am and 11am it will show 10 000 instructions (all instructions received since the beginning of time of our data set between 10am and 11am).

I'd like to see the average amount of instructions received between 10am and 11am.

And then how that average changes from 11am to 12pm, 12pm - 1pm etc.

So I would like to calculate how the average moves through out the day

Community Support

Hi @MichaelK,

>>So I would like to calculate how the average moves through out the day

You can add a slicer to get the average moves through out the day.

Slicer:

Line chart:

Use slicer to filter the result of specify hour daily movement.

>>And then how that average changes from 11am to 12pm, 12pm - 1pm etc.

You can use below measure to see the hourly movement:

Average of hour:

Avg Hour = AVERAGEX(FILTER(all(Sheet1), Sheet1[Hour]=max(Sheet1[Hour])),[Hourly Count])

Notice: the hour means the hour:00~hour:59:59.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Regular Visitor

Thank you!

Will give it a shot as soon as I get tthe time.

Thanks so much for the response!

Regular Visitor

Thanks a lot

Going to give it a try and will post feedback.

Announcements

#### The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

#### Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!