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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Datagulf
Responsive Resident
Responsive Resident

Calculate Average correctly and Rank a column using a calculated measure

NameKPI1(%)KPI2(%)KPI3(%)KPI4(%)KPI5(%)AverageRank
A10080 90960.7 
b88709093880.85 
c919497  0.56 
d  9894870.56 
e89 90891000.74 
        

I have a column name and Measures KPI 1 to KPI 5 all in percentage form. I have two problems here. 
First I want to calculate the average of the KPI's ignoring the blanks so if Name A has 4 KPIs filled, I want to divide by 4 for the average. This goes for all the names. That means I will need a count that does not have the blanks. 

The second thing I want to rank the averages from the highest to the Lowest and be able to return the names of the top 3 in some cards. Every answer will be highly appreciated. 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Datagulf ,

 

you can get the correct average with the following measure:

Average KPI = 
VAR vTableKPIs =
    UNION(
        ROW( "KPIs", SUM( myTable[KPI1(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI2(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI3(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI4(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI5(%)] ) )
    )
RETURN
    AVERAGEX(
        vTableKPIs,
        [KPIs]
    )

 

For the ranking you should get your result with the RANKX function.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

3 REPLIES 3
Datagulf
Responsive Resident
Responsive Resident

Hey @selimovd it worked. I appreciate.

selimovd
Super User
Super User

Hey @Datagulf ,

 

you can get the correct average with the following measure:

Average KPI = 
VAR vTableKPIs =
    UNION(
        ROW( "KPIs", SUM( myTable[KPI1(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI2(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI3(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI4(%)] ) ),
        ROW( "KPIs", SUM( myTable[KPI5(%)] ) )
    )
RETURN
    AVERAGEX(
        vTableKPIs,
        [KPIs]
    )

 

For the ranking you should get your result with the RANKX function.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Datagulf
Responsive Resident
Responsive Resident

Hey @selimovd , Thank you so much, this almost solves it. However, some of the KPI's are Measures derived from different tables. Like a division, how do we go about specifying the table name?

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors