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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Atiroocky
Frequent Visitor

Date/hour table - Create measure of day average depending on slicers

Hello all,

My request is a bit "tricky" so i tried to simplified it the most.

 

My data ("Value") are stored in a date/hour database, with a value each hour.

I created a date/time table to link all my data.

I want to show a table with :

  • first column = date/day/hour
  • second column = maximum hour values
  • third column = day average value (measure)

 

day_average = 
AVERAGEX( ALL(Table_date[Date_heure]), CALCULATE( [Value], VALUES (Table_date[Date] ) ))

 

The table will be "filtered" by slicers, especially "hour" slicer, which will reduce the size of a the days.

To do so, I already created measures, but I’m facing an issue.

The measure that calculates the "day average" values works. But it is not affected by slicers. If I want to shorten day with the slicer by 10h-19h instead of 0h-23h, the result of this measure will not change. I tried to replace  the

ALL()

by

ALLSELECTED()

whitout any change of the results.

 

I found a "workaround" (right table in the image) wich consists of showing a table with date/day lines (instead of date/time/hour). I add a mesure to calculate the max value of a day, and the average value. The results of these two measures are properly affected by slicers.

 

So, for the date/hour table, how can I write a mesure which will calculate the day average, and take care of slicers values ?

 

PowerBI-measure average issue.png

 

 

Thanks for your help.

1 ACCEPTED SOLUTION
Atiroocky
Frequent Visitor

As I continue to investigate by my side, I think I found out the issue.

Sometimes, the "Value" (which is calculated) is shown as "infiny"

When I get rid of the "infiny" value in the filter pannel, and replace ALL by ALLSELECTED in the measure, it finally works !

 

day_average = 
AVERAGEX( ALLSELECTED(Table_date[Date_heure]), CALCULATE( [Value], VALUES (Table_date[Date] ) ))

 

Atiroocky_0-1718093162243.png
Atiroocky_2-1718093246799.pngAtiroocky_1-1718093233821.png

 

 

View solution in original post

1 REPLY 1
Atiroocky
Frequent Visitor

As I continue to investigate by my side, I think I found out the issue.

Sometimes, the "Value" (which is calculated) is shown as "infiny"

When I get rid of the "infiny" value in the filter pannel, and replace ALL by ALLSELECTED in the measure, it finally works !

 

day_average = 
AVERAGEX( ALLSELECTED(Table_date[Date_heure]), CALCULATE( [Value], VALUES (Table_date[Date] ) ))

 

Atiroocky_0-1718093162243.png
Atiroocky_2-1718093246799.pngAtiroocky_1-1718093233821.png

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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