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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Power_It_Up
Helper II
Helper II

Average total for month / For values greater than zero

Hi there,

 

Here is an example of my DAX requirement.  It's to average ValueA by ValueB, but only if there is a value for ValueB (see below example):-

 

Month.....ValueA.....ValueB......ExpectedResult

JAN..............100............22....................4.55.............

FEB..............150.............37....................4.05.............

MAR............197........................................0................

 

My aim is to calculate the current yearly running average and place into a scorecard, but don't want to include months that do not have a value for ValueB.

 

So for the above example, it would be (100+150) / 22+37) = 4.24 (excluding MAR and any future months.

 

Many thanks in advance. 🙂

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Power_It_Up 

Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1706495707354.png

Measures:

 

Measure A = SUM('Table'[ValueA])

Measure B = SUM('Table'[ValueB])

Average =

CALCULATE (

    DIVIDE ( 'Table'[Measure A], 'Table'[Measure B] ),

    FILTER ( 'Table', 'Table'[Measure B] > 0 )

)

 

 

If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi, @Power_It_Up 

Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1706495707354.png

Measures:

 

Measure A = SUM('Table'[ValueA])

Measure B = SUM('Table'[ValueB])

Average =

CALCULATE (

    DIVIDE ( 'Table'[Measure A], 'Table'[Measure B] ),

    FILTER ( 'Table', 'Table'[Measure B] > 0 )

)

 

 

If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

@Anonymous 

Hi Yang.  Many thanks for your calc and demo.  This worked well! 🙂

bhanu_gautam
Super User
Super User

@Power_It_Up , Try using below mentioned method

 

RunningAverage =
CALCULATE(
AVERAGE(Table[ValueA]),
FILTER(
ALL(Table),
NOT(ISBLANK(Table[ValueB]))
)
)

 

Please accept as solution and give kudos if it helps




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

Proud to be a Super User!




LinkedIn






It's nearly there, but it's not just the average of ValueA.  It's dividing ValueA by ValueB as long as there is a ValueB in the month.  Thanks again. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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