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
NNaj
Helper IV
Helper IV

Average of a measure

Hi All,

 

I have a measure that calculates a % of 2 numebers. This measure is in a table.

 

I want to insert a card that calculates the AVERAGE of the values of this measure in the table.

 

I have a date slicer that changes these percentages and would like the Average to change accordingly.

 

Thank you in advance for your help.

 

1 ACCEPTED SOLUTION

Try
AAVERAGEEE p1 take 2 =
AVERAGEX(
    SUMMARIZE(SQL_DEXTR_FI_Quotes,
      SQL_DEXTR_FI_Quotes[CHR_REPORT_COUNTERPARTY_NAME],
        "_hit",
        [Hit (£m) P1],
        "_shown",
        [Shown (£m) P1]),
    divide([_hit],[_shown])
)
 
If needed remove if from the calculations. Just return the calculation part

View solution in original post

7 REPLIES 7
NNaj
Helper IV
Helper IV

Try Like

AVERAGEX(
    SUMMARIZE(table,
      table[Names],
        "_hit", 
		sum([Hit (£m) P1]),
		"_shown"
		sum([Shown (£m) P1])
    ),
    divide([_hit],[_shown])
)

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Thank you for your response @amitchandak 

 

I get an error stating that the sum expression only accepts a column a an argument and both shown and Hit are measures.

 

Any way around this?

Share your formula. Also the calculation of any measure you want to use.

Shown (£m) P1 =
Var ShownP1= CALCULATE(SUM(SQL_DEXTR_FI_Quotes[ORIG_FACE_GBP (£m)]),DATESBETWEEN(SQL_DEXTR_FI_Quotes[EXECUTION DATE],Current_Period_Start_Table[Current_Period_Start_Meas],Current_Period_End_Table[Current_Period_End_Meas]))
Return
IF(ISBLANK(ShownP1),0,ShownP1)
 
 
Hit (£m) P1 =
VAR HitP1 = CALCULATE(SUM(SQL_DEXTR_FI_Quotes[ORIG_FACE_GBP (£m)]), SQL_DEXTR_FI_Quotes[WIN_FLAG]= TRUE(),DATESBETWEEN(SQL_DEXTR_FI_Quotes[EXECUTION DATE],Current_Period_Start_Table[Current_Period_Start_Meas],Current_Period_End_Table[Current_Period_End_Meas]))
Return
IF(ISBLANK(HitP1),0,HitP1)
 
 
Hit % P1 =
IF([Shown (£m) P1] = 0, 0,  [Hit (£m) P1] / [Shown (£m) P1])
 
1st formula I tried:
AVERAGE =
AVERAGEX(
    SUMMARIZE(SQL_DEXTR_FI_Quotes,
        SQL_DEXTR_FI_Quotes[CHR_REPORT_COUNTERPARTY_NAME],
        "Average", DIVIDE([Hit (£m) P1],[Shown (£m) P1])
    ),
    [Average]
)
 
2nd formula: Your recommendation @amitchandak 
 
AAVERAGEEE p1 take 2 =
AVERAGEX(
    SUMMARIZE(SQL_DEXTR_FI_Quotes,
      SQL_DEXTR_FI_Quotes[CHR_REPORT_COUNTERPARTY_NAME],
        "_hit",
        SUM([Hit (£m) P1]),
        "_shown",
        SUM([Shown (£m) P1])),
    divide([_hit],[_shown])
)
 
 

Try
AAVERAGEEE p1 take 2 =
AVERAGEX(
    SUMMARIZE(SQL_DEXTR_FI_Quotes,
      SQL_DEXTR_FI_Quotes[CHR_REPORT_COUNTERPARTY_NAME],
        "_hit",
        [Hit (£m) P1],
        "_shown",
        [Shown (£m) P1]),
    divide([_hit],[_shown])
)
 
If needed remove if from the calculations. Just return the calculation part
NNaj
Helper IV
Helper IV

I tried to do this but it does not work as x and y are both measures. 

 

x= quotes shown

y= winvalue

 

win% = x/y

 

and now I am trying to get an average of win% for each entry.

 

NameShown (measure)hit (or win value) (measurehit% or win%
A1005050%
B2005025%
C30010033.3%
D4005012.5%

 

 

I need an average of this last column

 

I tried: but the answer is wrong compared to manually done on excel for testing.

AAVERAGEEE =
AVERAGEX(
    SUMMARIZE(table,
      table[Names],
        "Average", DIVIDE([Hit (£m) P1],[Shown (£m) P1])
    ),
    [Average]
)

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.