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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
VijayAntonyM
Helper I
Helper I

Average the number based one main column in DAX

Team,

 

I Have 3 columns in table , Stations , Hour and Count as below,

 

Station  Hour     Count  Average

ST1        1 AM    10        13.3

ST1        2 AM    30        13.3

ST1        3 AM                13.3

 

Average should be calculated by Station only eventhough the Hour column does have blank, 40/3=13.33

 

Kindly help

regards

M. Vijay Antony

2 ACCEPTED SOLUTIONS
v-nuoc-msft
Community Support
Community Support

Hi @VijayAntonyM 

For your question, here is the method I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1705282604993.png

 

Create a measure. Based on station groupings, the average value is calculated.

vnuocmsft_1-1705282774184.png

Average = 
    VAR _COUNT = 
        CALCULATE(
            SUM('Table'[Count]), 
            FILTER(ALL('Table'),
                'Table'[Station] = MAX('Table'[Station])
                )
            )
    VAR _STATION = 
        CALCULATE(
            COUNTROWS('Table'), 
            FILTER(ALL('Table'), 
                'Table'[Station] = MAX('Table'[Station])
                )
            )
RETURN DIVIDE(_COUNT, _STATION)

 

Here is the result

vnuocmsft_2-1705282829938.png

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Write these measures

C = SUM(Data[Count])
Measure = divide(CALCULATE([C],ALL(Data[Hour])),CALCULATE(COUNTROWS(Data),ALL(Data[Hour])))

Hope this helps.

Ashish_Mathur_0-1705288569363.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Write these measures

C = SUM(Data[Count])
Measure = divide(CALCULATE([C],ALL(Data[Hour])),CALCULATE(COUNTROWS(Data),ALL(Data[Hour])))

Hope this helps.

Ashish_Mathur_0-1705288569363.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-nuoc-msft
Community Support
Community Support

Hi @VijayAntonyM 

For your question, here is the method I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1705282604993.png

 

Create a measure. Based on station groupings, the average value is calculated.

vnuocmsft_1-1705282774184.png

Average = 
    VAR _COUNT = 
        CALCULATE(
            SUM('Table'[Count]), 
            FILTER(ALL('Table'),
                'Table'[Station] = MAX('Table'[Station])
                )
            )
    VAR _STATION = 
        CALCULATE(
            COUNTROWS('Table'), 
            FILTER(ALL('Table'), 
                'Table'[Station] = MAX('Table'[Station])
                )
            )
RETURN DIVIDE(_COUNT, _STATION)

 

Here is the result

vnuocmsft_2-1705282829938.png

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks for the solution

VijayAntonyM
Helper I
Helper I

Team, Can someone help me on this?

Anonymous
Not applicable

Hi @VijayAntonyM ,

Thanks for using Fabric Community.
Is this query related to DAX - Power BI?

Yes , related to DAX in Power BI desktop.

Makesure the relationship, filters should not be affected

 

Anonymous
Not applicable

I am moving this to Power BI forum there you can get some help.

Thank you

thanks much

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.