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
cnesr
Frequent Visitor

Multi-level aggregation using DAX measures

Hello,

 

I am very new to Power BI Desktop. Thank you very much for your help.

 

I have a table of traffic data with the following columns:

 

  • Date & Time (by hour)
  • Date (by day)
  • Year (2012 to 2018)
  • Month (1 to 12)
  • Day (1 to 31)
  • Day of Week (Monday to Sunday)
  • Hour (0 to 23)
  • Northbound Vehicle Counts
  • Southbound Vehicle Counts
  • Total Vehicle Counts

I need to calculate the Monthly Average Daily Traffic (MADT). MADT is calculated by averaging the Hour of the day by the Day of Week by the Month of the Year. This will yield a 24-hour profile for each Day of Week (Monday to Sunday) by Month and Year. The 24-hour profile is then summed to a produce a daily traffic count. These 7 daily traffic figures are then averaged to create the MADT.

 

I think this is a matter of using nested AVERAGEX functions to create a measure, but I have not had success. I have had success in Excel, but I would really like to do it in Power BI.

 

This is probably terribly explained. Please let me know what further details are required.

 

Thank you so much for your help!!

2 REPLIES 2
Seward12533
Solution Sage
Solution Sage

You may want to look at Date-Time Table with granularity for every hour of the day for every day from 2012-2018 then relate that to yoru Date and Time by hour column. You then just need to write a Simple Measures for the averages. Total Average = AVERAGE(table[total vehicle counts])

 

You can then use the Time Inteligence features of DAX.  Tip youse the Day, Hour, Week, Month, Year from the date-time table not your Data Table and to keep things clean I'd remove all your Date and time related columns other than your Date/Time column.

 

See this link for creating the DateTime Table in Powerquery https://community.powerbi.com/t5/Desktop/Has-anyone-created-datetime-table-using-QueryEditor-or-DAX...

Thank you very much @Seward12533. I will try this.

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.