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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Nathaniel_C
Community Champion
Community Champion

Average

Hi All,

This works with a single month selected, but not with multiple months.  Trying to show the average of what shows in the visual, and then color format the column background.

This is my pbix 

Nathaniel_C_0-1660519324754.png  

Nathaniel_C_1-1660519393293.png

Thank you!


Nathaniel

 





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

Proud to be a Super User!




3 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Could you please try the below whether it provides the result that you want?

 

Average =
AVERAGEX (
    FILTER (
        ADDCOLUMNS (
            VALUES ( 'DataTable'[Name] ),
            "@ERecsperhour", CALCULATE ( SUM ( 'DataTable'[E-Recs per Hour] ) )
        ),
        [@ERecsperhour] <> 0
    ),
    [@ERecsperhour]
)

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

CNENFRNL
Community Champion
Community Champion

Average = AVERAGE('DataTable'[E-Recs per Hour])
= AVERAGEX('DataTable', 'DataTable'[E-Recs per Hour])

the calculation of average is based on the rows of 'DataTable' in the current filter context; it has nothing to do with the calculation in the table viz.

 

AVG = 
VAR __n = VALUES( 'DataTable'[Name] )
RETURN
    SUMX( __n, CALCULATE( SUM( 'DataTable'[E-Recs per Hour] ) ) )
        / COUNTROWS( __n )

CNENFRNL_0-1660534341940.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

tamerj1
Super User
Super User

Hi @Nathaniel_C 
Here is the sample file with the solutoion https://www.dropbox.com/t/M7zX39R3UdSCO9SR

You want to calculate the average of the sum. The row level average won't help. Can follow this 

Average New = 
AVERAGEX ( 
    VALUES ( 'DataTable'[Name] ),
    CALCULATE ( SUM ( 'DataTable'[E-Recs per Hour] ) )
)

View solution in original post

4 REPLIES 4
Nathaniel_C
Community Champion
Community Champion

Hi @Jihwan_Kim @tamerj1 @CNENFRNL ,
Thank you all,

Three different solutions, that all work!


Nathaniel





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

Proud to be a Super User!




tamerj1
Super User
Super User

Hi @Nathaniel_C 
Here is the sample file with the solutoion https://www.dropbox.com/t/M7zX39R3UdSCO9SR

You want to calculate the average of the sum. The row level average won't help. Can follow this 

Average New = 
AVERAGEX ( 
    VALUES ( 'DataTable'[Name] ),
    CALCULATE ( SUM ( 'DataTable'[E-Recs per Hour] ) )
)
CNENFRNL
Community Champion
Community Champion

Average = AVERAGE('DataTable'[E-Recs per Hour])
= AVERAGEX('DataTable', 'DataTable'[E-Recs per Hour])

the calculation of average is based on the rows of 'DataTable' in the current filter context; it has nothing to do with the calculation in the table viz.

 

AVG = 
VAR __n = VALUES( 'DataTable'[Name] )
RETURN
    SUMX( __n, CALCULATE( SUM( 'DataTable'[E-Recs per Hour] ) ) )
        / COUNTROWS( __n )

CNENFRNL_0-1660534341940.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Jihwan_Kim
Super User
Super User

Hi,

Could you please try the below whether it provides the result that you want?

 

Average =
AVERAGEX (
    FILTER (
        ADDCOLUMNS (
            VALUES ( 'DataTable'[Name] ),
            "@ERecsperhour", CALCULATE ( SUM ( 'DataTable'[E-Recs per Hour] ) )
        ),
        [@ERecsperhour] <> 0
    ),
    [@ERecsperhour]
)

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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