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
nganbla
Helper II
Helper II

Average volume by week based on rolling calendar

hi all

 

i have 2 table for this simply situation

 

1 rolling calerdar with: date (mm/dd/yyyy) / year / month / week

sales database with: product line (A / B / C ) / sold date / calculated column month & week / volume of product

 

I made one to many relationship btw date and sold date

 

I created matrix to show product sold by week / month by drill up/down => auto show total amount => it's ok now

 

I have a issue when try to make Average product by week.

 

for example: we have 6 week data (by slicer rolling calendar)

 wk 1wk 2wk 3wk 4wk 5wk 6TotalAvg
Product A......13423518(i want 18 / 6 week) 3
Product B......2 4   6i want 6/6 => 1

 

i create measue to count total week is 6. but when select product B, total week is count 2 only, then avg go wrong

 

pls help a look and guide.

 

thank you

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @nganbla ,

 

We can use the following steps to meet your requirement.

 

1. Create a week column in sales table.

 

week = WEEKNUM(sales[sold date],2)

 

A 1.jpg

 

2. Then create a measure to calculate the average of volume.

 

Measure = 
DIVIDE(CALCULATE(SUM(sales[volume of product])),CALCULATE(DISTINCTCOUNT(sales[week]),ALLSELECTED()),0)

 

A 2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

View solution in original post

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @nganbla ,

 

We can use the following steps to meet your requirement.

 

1. Create a week column in sales table.

 

week = WEEKNUM(sales[sold date],2)

 

A 1.jpg

 

2. Then create a measure to calculate the average of volume.

 

Measure = 
DIVIDE(CALCULATE(SUM(sales[volume of product])),CALCULATE(DISTINCTCOUNT(sales[week]),ALLSELECTED()),0)

 

A 2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

amitchandak
Super User
Super User

@nganbla , Try like

AverageX(summarize(table, table[Product ], Date[Week], "_mes",Sum(Table[volume])),[_mes])

 

Sum till Product week level, Avg post that

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.