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
powerbi12345
Frequent Visitor

Getting Average of Measure

On one of my line charts, I have measures which contain percentages for all females for a number of groups.

 

When I put the measure on a line graph, it shows the sum of all percentages = 500%, however I want to get the average = 92%. I can do this with normal column variables, but it doesn't allow me to do it with measure.

 

Do you know how I can do this with measures?

10 REPLIES 10
rajulshah
Super User
Super User

Hello @powerbi12345,

 

You can use the following DAX:

Average Value = AVERAGEX(SUMMARIZE(Table,Table[Group],"AverageV",[Average Measure]),[AverageV])


Please let me know if this didn't help and provide more details so that I can help you with accurate DAX function. 

@rajulshah  Thanks for replying. How would I apply that DAX function to my current measure? This is the code for it:
 
MALE PRESENT NATIONAL =
CALCULATE(
[Present Percent National],
'All Years Characteristics'[Characteristics] = "MALE"
)
 

@powerbi12345,

So, what I understand is you want to average the value among female and male, right?

@rajulshah  Yes, but I have the male and female in measures. When I put them on the line chart, I can't select average. I could only do that if they were columns, but in this case they have to be measures

So, you can try creating 2 measures for Male and Female.

Male Average =
AVERAGEX (
    FILTER (
        SUMMARIZE (
            'All Years Characteristics',
            'All Years Characteristics'[Characteristics],
            "AverageV", [Present Percent National]
        ),
        'All Years Characteristics'[Characteristics] = "MALE"
    ),
    [AverageV]
)
Female Average =
AVERAGEX (
    FILTER (
        SUMMARIZE (
            'All Years Characteristics',
            'All Years Characteristics'[Characteristics],
            "AverageV", [Present Percent National]
        ),
        'All Years Characteristics'[Characteristics] = "FEMALE"
    ),
    [AverageV]
)

 

Hope this helps.

Thanks rajulshah

But that didn't return the average, it produced the same result as I had before

@powerbi12345, can you please provide sample data and snapshot of what is showed in the table?

rajulshah If I made a calculated column, it would have this code:

 

MALE PRESENT NATIONAL =
CALCULATE(
[Present Percent National],
'All Years Characteristics'[Characteristics] = "MALE"
)
 
And then I would select Average on the line chart instead of Sum. However, it needs to be a measure, so I used the same code but it wont let me select average.

@powerbi12345,

 

I guess I could help efficiently if there maybe any sample data available.

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.