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
Sail_v
New Member

Calculate average per weekday and customer

Hi! 

I am new to Power BI. I’m trying to figure out how to create a new measure.

 

I would like to calculate the total number of units sold for a specific date and customer as a percentage of the average for the same customer and weekday (e.g. Monday). 

 

My data set contains several transactions each day for the same customer. 

I have created a date table in addition to my dataset.

 

The data look something like this:

Transaktion ID

Date

Weekday

Customer

Units sold

2

8/9/2022

3

A

80

3

8/9/2022

3

A

20

4

8/9/2022

3

A

20

1

8/9/2022

3

B

10

28

8/16/2022

3

A

80

 

 

 

 

 

And I would like to create a visual with the following information:

Date

Weekday

Customer

Total units sold

Average units sold per weekday and customer

Total units sold as a percentage of average

8/9/2022

3

A

120

100

120%

 

 

 

 

 

 

It would also be nice to limit the calculated average to a date in period e.g. 2 months from last transaction.

 

Any tips?

 

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

Please find a file with a solution attached...

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

Please find a file with a solution attached...

amitchandak
Super User
Super User

@Sail_v ,

 

calculate(Averagex(values(Table[Date]), calculate(Sum(Table[Units sold])) ), filter(allselected(Table), Table[Customer] = max(Table[Customer])  && Table[Weekday] = Max(Table[Weekday]) ))

 

Better to have week day column = Weekday([Date])

 

if you use date table,

 

calculate(Averagex(values(Table[Date]), calculate(Sum(Table[Units sold])) ), filter(allselected(Date),   Date[Weekday] = Max(Date[Weekday]) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.