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
NPH2020
Regular Visitor

Monthly averages issue

Hi all

 

I have a problem with monthly averages :

 

My underlying data is rolled up at a monthly level but one key parameter is the average daily volume.  This is calculated on a workday basis subject to bespoke holidays so I have this in a separate table.  I can easily define a a calcualted column to create the averages and this works to display the data correctly on a monthly basis but i need to be able to show the averages over quarters and years.

 

I have failed in linking the related number of workdays in the separate table while still calcuating the separate averages.  My aim is for this as a dynamic mneasure :

 

Sum of attribute / sum of period workdays (from related table)

 

Any guidance appreciated.

 

THanks !

5 REPLIES 5
amitchandak
Super User
Super User

@NPH2020 Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

if you have a common date table for both, you should be able to analyze these across month ,qtr and year.

Hi

 

Datasets as per below :

 

Table 1  
   
EOMattributeValue
31-JanA118
31-JanB50
31-JanC62
31-JanD173
28-FebA179
28-FebB153
28-FebC27
31-MarB92
31-MarC40
31-MarD39
30-AprA16
30-AprB191
30-AprC12
30-AprD42
30-AprE35
31-MayB152
31-MayC190
31-MayD158
31-MayE191
30-JunA93
30-JunB61
30-JunC158
30-JunD53
30-JunE118

 

Table 2 
  
EOMWork day
31-Jan18
28-Feb19
31-Mar22
30-Apr18
31-May16
30-Jun22
31-Jul20

 

Many thanks

@NPH2020 , Join to a common date table and there you can have a month, qtr and year.

 

You can create a measure like

Divide(Sum(Tabel1[Value]), sum(Table2[Work day]))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

Hi

 

Sadly as the mock up of the data didn't account for the fact that the attrubtes repeat in the months and so it is summing the numerator correctly but then dividing but multiple sums of the workdays, rather than one.  I have tried the "distinct" function and it does not like that in sum functions, nor does it allow me to sum related columns.  It works as a calculated column, but then the aggregation doesn't.

 

sorry for the original dataset issue....

@NPH2020 , Try

 

Divide(Sum(Tabel1[Value]), sumX(Summarize(Table2, Table2[EOM],"_1" ,max(Table2[Work day])),[_1]))

 

 

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.