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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Find Average for desired period

Hi Everyone,

 

I have a dataset like this:

Wroclaw_0-1715151989529.jpeg

 

And I want to find an avarage amount per month, but only including months from first non-blank month to last non-blank month (in my example 202204 - 202305), so the outcome will be like this:

Wroclaw_1-1715152857966.jpeg

 

any idea for DAX formula which can achieve this? Thanks, Wroclaw

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

you can try to create a column

 

Column =
VAR _start=minx(FILTER('Table',not(ISBLANK('Table'[Amount]))),'Table'[YM])
var _end=maxx(FILTER('Table',not(ISBLANK('Table'[Amount]))),'Table'[YM])
return if('Table'[YM]>=_start&&'Table'[YM]<=_end,sum('Table'[Amount])/CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[YM]>=_start&&'Table'[YM]<=_end)))
 
11.PNG

 





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@Anonymous 

you can try to create a column

 

Column =
VAR _start=minx(FILTER('Table',not(ISBLANK('Table'[Amount]))),'Table'[YM])
var _end=maxx(FILTER('Table',not(ISBLANK('Table'[Amount]))),'Table'[YM])
return if('Table'[YM]>=_start&&'Table'[YM]<=_end,sum('Table'[Amount])/CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[YM]>=_start&&'Table'[YM]<=_end)))
 
11.PNG

 





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

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.