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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Wroclaw
Regular Visitor

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

@Wroclaw 

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

@Wroclaw 

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.