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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.