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
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
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.