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

A measure which shows the average weekly qty of products sold based on the last 12 weeks of sale

My objective is the following
 
from my 'sales' table I wish to create a column or measure which shows me the average weekly quanity of products sold based on the last 12 weeks of sales only?
 
my thought process was to filter the table to show only the last 12 weeks of data only.
Then to find the weekly average of goods sold I would sum the quantity and divide by 12
 
Is this a good route and would anyone know the DAX to achieve this??

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

Hi @dhallnash.

 

You can try to use below formula if it works on your side:


Average Of Last 12 Weeks= DIVIDE(SUMX(FILTER(ALL(Table),[DateColumn]>=LASTDATE(VALUES(Table[DateColumn]))-12*7&&[DateColumn]<=LASTDATE(VALUES(Table[DateColumn]))),[ValueColumn]),12,-1)


Notice: Table is the specify table, DateColumn is the date filed,  ValueColumn is the value which your need to calculate the average.

 

If above not help, please prove some sample data.

 

Regards,

Xiaoxin Sheng

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

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @dhallnash.

 

You can try to use below formula if it works on your side:


Average Of Last 12 Weeks= DIVIDE(SUMX(FILTER(ALL(Table),[DateColumn]>=LASTDATE(VALUES(Table[DateColumn]))-12*7&&[DateColumn]<=LASTDATE(VALUES(Table[DateColumn]))),[ValueColumn]),12,-1)


Notice: Table is the specify table, DateColumn is the date filed,  ValueColumn is the value which your need to calculate the average.

 

If above not help, please prove some sample data.

 

Regards,

Xiaoxin Sheng

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

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.