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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Averaging minimum value of each day

Hello,

I've just hit a wall on my dax comptencies :

I have a model with 1 data per hour, 24/7.

 

I'm need to create a measure which :

- Find the minimum value of the day

- If i'm at week granularity, I need the average of the minimum value of each day of the week

- If i'm at month granularity, I need the average of the minimum value of each day of the month

 

I don't think it is very complicated to do but I'm missing somethink with dax and the context filters.

 

Thanks for your help !

Jo

1 ACCEPTED SOLUTION

Hi  @Anonymous ,

 

First create a week and a month column to get the related week  and month number;

Then create a calculated column as below:

minvalue = IF('Table'[Value]=CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Date])),[Value],BLANK())

Then create a measure as below:

Measure = 
var _daysforweek=CALCULATE(DISTINCTCOUNT('Table'[Date]),FILTER(ALL('Table'),'Table'[Weeknum]=MAX('Table'[Weeknum])))
var _daysformonth=CALCULATE(DISTINCTCOUNT('Table'[Date]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
Return
IF(ISFILTERED('Table'[Weeknum]),DIVIDE(SUMX(FILTER(ALL('Table'),'Table'[Weeknum]=SELECTEDVALUE('Table'[Weeknum])),'Table'[minvalue]),_daysforweek),
IF(ISFILTERED('Table'[Month]),DIVIDE(SUMX(FILTER(ALL('Table'),'Table'[Month]=SELECTEDVALUE('Table'[Month])),'Table'[minvalue]),_daysformonth)))

And you will see:

v-kelly-msft_0-1614653768430.png

v-kelly-msft_1-1614653779979.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

You probably need something like this (may not be performant at large scale).

 

Avg Daily Min = AVERAGEX(VALUES('Date'[Date]), CALCULATE(MIN(Table[Value])))

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


amitchandak
Super User
Super User

@Anonymous , Assume value1 is a measure for which you need min at the day level. Till day level calculation can be

 

value1 = sum(Table[col1])

 

minx(values(Table[Date]), [Value1]) //Min at any level above day

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak  thanks for your quick reply but your solution is only the easy part :

The difficult part is to get the right calculation at week and month level.

For example at week level :

Min(monday) = 4

Min(tuesday) = 4

Min(Wed) = 4

Min(thu) = 6

Min(Fri) = 8

Min(Sat) = 8

Min(Sun) = 8

The result I'm expecting at week level is the average of the min of each day. ie average (4+4+4+6+8+8+8) = 6.

Did I explain it better ? Thanks for your help !

Jo

Hi  @Anonymous ,

 

First create a week and a month column to get the related week  and month number;

Then create a calculated column as below:

minvalue = IF('Table'[Value]=CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Date])),[Value],BLANK())

Then create a measure as below:

Measure = 
var _daysforweek=CALCULATE(DISTINCTCOUNT('Table'[Date]),FILTER(ALL('Table'),'Table'[Weeknum]=MAX('Table'[Weeknum])))
var _daysformonth=CALCULATE(DISTINCTCOUNT('Table'[Date]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
Return
IF(ISFILTERED('Table'[Weeknum]),DIVIDE(SUMX(FILTER(ALL('Table'),'Table'[Weeknum]=SELECTEDVALUE('Table'[Weeknum])),'Table'[minvalue]),_daysforweek),
IF(ISFILTERED('Table'[Month]),DIVIDE(SUMX(FILTER(ALL('Table'),'Table'[Month]=SELECTEDVALUE('Table'[Month])),'Table'[minvalue]),_daysformonth)))

And you will see:

v-kelly-msft_0-1614653768430.png

v-kelly-msft_1-1614653779979.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors