Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Calculate Weekly Average

Dear all,

 

I'm trying to obtain (either as a custom column or through a measure) the weekly average of the Import - Units (see below table, first column from the right). 

 

As you can see, there are multiple sizes/types of containers, multiple ports of origin and destination, which add complexity.

 

For example, taking into consideration the first row, I'd like to know the Weekly Average Import Units that are:

  • 20DV
  • with Port of Origin Code "BRNVT"
  • with Intended Port of Destination Code "ALDRZ"

I should then be able to obtain aggregated weekly averages at, for instance, Destination Country level or Destination Region level.

 

Container Size TypePort Of Origin CodePort Of Origin RegionDestination CountryPort Of Destination CodeDestinationRegionImport DateImport - Units
20DVBRNVTSAECALBANIAALDRZBALKAN05.01.2018 00:001
20DVCNDLCNORTH CHINAALBANIAALDRZBALKAN05.01.2018 00:002
20DVCNNGBNORTH CHINAALBANIAALDRZBALKAN05.01.2018 00:0028
20DVCNNSAS. CH + HK + TWALBANIAALDRZBALKAN05.01.2018 00:004
40DVCNQZHS. CH + HK + TWALBANIAALDRZBALKAN05.01.2018 00:005
40DVCNSHKS. CH + HK + TWALBANIAALDRZBALKAN05.01.2018 00:0061
40DVCNTAONORTH CHINAALBANIAALDRZBALKAN05.01.2018 00:004
40DVCNTXGNORTH CHINAALBANIAALDRZBALKAN05.01.2018 00:0019
40HCCNXMNS. CH + HK + TWALBANIAALDRZBALKAN05.01.2018 00:0020
20RECNYTNS. CH + HK + TWALBANIAALDRZBALKAN05.01.2018 00:006
20DVGBLGPNWC + UK + IRLANGOLAAOLADANG + NAM12.06.2018 00:001
20DVIDSUBSE ASIAANGOLAAOLADANG + NAM12.06.2018 00:0023
20DVINHZAN. INDIA + PAKANGOLAAOLADANG + NAM12.06.2018 00:0016
20DVITGOAWEST MEDANGOLAAOLADANG + NAM12.06.2018 00:002
20DVITNAPWEST MEDANGOLAAOLADANG + NAM12.06.2018 00:0014
20DVITSPEWEST MEDANGOLAAOLADANG + NAM12.06.2018 00:0016
20DVJPHIJJAPANANGOLAAOLADANG + NAM12.06.2018 00:001

 

Any assistance will be much appreciated.

 

 

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can create column Average to get aggregated weekly averages at Destination Country level or Destination Region level.

 

Average = CALCULATE(AVERAGE(Table1[Import - Units]),FILTER(ALLSELECTED(Table1),OR(Table1[Destination Country]=EARLIER(Table1[Destination Country]),Table1[DestinationRegion]=EARLIER(Table1[DestinationRegion]))))

 

4.png 

 

 

Best Regards,

Amy

 

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

1 REPLY 1
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can create column Average to get aggregated weekly averages at Destination Country level or Destination Region level.

 

Average = CALCULATE(AVERAGE(Table1[Import - Units]),FILTER(ALLSELECTED(Table1),OR(Table1[Destination Country]=EARLIER(Table1[Destination Country]),Table1[DestinationRegion]=EARLIER(Table1[DestinationRegion]))))

 

4.png 

 

 

Best Regards,

Amy

 

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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