March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I would like to calculate the average per day for each month for the following measure.
With the average calculation above it gives the following results which are not what I want.
Solved! Go to Solution.
Hi,
Revise the measure to
Days Test = DIVIDE(COUNTX(ADDCOLUMNS(GENERATE('tblHolidayDates_all locations',DATESBETWEEN('Calendar'[Calendar Date],'tblHolidayDates_all locations'[StartDate],'tblHolidayDates_all locations'[EndDate])),"period",MAXX(FILTER('Calendar','Calendar'[Calendar Date]=EARLIER('Calendar'[Calendar Date])),'Calendar'[Year])),[period]),COUNTROWS('Calendar'))
Hope this helps.
but I believe it averages over all the rows of the month not all the days.
Add an intermediate step with SUMMARIZE or SUMMARIZECOLUMNS that pre-aggregates your data by day.
Thank you for your reply. Could you be a bit more specific please?
Please provide a smaller sample file. Yours is way too big.
The below is a screenshot of the table tblHolidayDates_all locations
and the below is a screenshot of the table Calendar
Appreciate your help
Touche. I should have specified that I cannot work with screenshots. Please provide sample data that fully covers your issue but not more, in a usable format.
Please show the expected outcome based on the sample data you provided.
This is tblHolidayDates_all locations
This is Calendar
This calculates the days in every month
Days Test = COUNTX(ADDCOLUMNS(GENERATE('tblHolidayDates_all locations',DATESBETWEEN('Calendar'[Calendar Date],'tblHolidayDates_all locations'[StartDate],'tblHolidayDates_all locations'[EndDate])),"period",MAXX(FILTER('Calendar','Calendar'[Calendar Date]=EARLIER('Calendar'[Calendar Date])),'Calendar'[Year])),[period])
I want the average of Days Test per day by month. For example if the output for the days is
I would like for January the Site Service average to be 53/31 = 1.70, February 64/28=2.29 and so on. If I do Average Days = AVERAGEX('tblHolidayDates_all locations',[Days Test]) it gives me a different result which I believe it averages the days over how many rows are in the specific month not the total days of the month.
Thank you
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |