Forum Discussion

milonsarker's avatar
milonsarker
Regular Visitor
1 year ago
Solved

Weighted Average at Row Level in Power BI Matrix Visual

Trying to develop a Power BI matrix visual which will show raw data in row level. I was able to show row level data by adding the Ranked column to the rows section of visual. Then in the total section, I need a custom calculation. Weighted Average Stipend is needed.

The formula is :

Weighted Stipend Average = SUM(Stipend * Number of Assistant)/SUM(Number of Assistant)

Here,

Stipend means various stipend like Teaching, Research, Graduate etc

Number of Assistant means number of teaching assistant, research assistant, graduate assistant etc

I tried using measure but I couldn't add measure in row level for every sub-category. Here is the table structure:

Here is the visual set up in Power BI:

 

 

Sample Data: 

DATA_TYPE_LABELCIP_6RankedTeaching_StipendTeaching_NumResearch_StipendResearch_Num
Doctorate Adjusted Ranked Salaries'01.00001541033350511241
Doctorate Adjusted Ranked Salaries'01.0000243147284342231
Doctorate Adjusted Ranked Salaries'01.000034242084301539
Doctorate Adjusted Ranked Salaries'01.0000442342240583219
Doctorate Adjusted Ranked Salaries'01.000054188153434694
Doctorate Adjusted Ranked Salaries'01.000063548643366035
Doctorate Adjusted Ranked Salaries'01.0000734885333307951
Doctorate Adjusted Ranked Salaries'01.000083432323304196
Doctorate Adjusted Ranked Salaries'01.0000933008632460100
Doctorate Adjusted Ranked Salaries'01.00001031741832313107
Doctorate Adjusted Ranked Salaries'01.00001131060313147241
Doctorate Adjusted Ranked Salaries'01.00001230871931293241
Doctorate Adjusted Ranked Salaries'01.00001329555831285165
Doctorate Adjusted Ranked Salaries'01.0000142861392914769
Doctorate Adjusted Ranked Salaries'01.0000152855342812749
Doctorate Adjusted Ranked Salaries'01.0000162831514277098
Doctorate Adjusted Ranked Salaries'01.00001726891427377110
Doctorate Adjusted Ranked Salaries'01.000018249039264264
Doctorate Adjusted Ranked Salaries'01.0000192471472629459
Doctorate Adjusted Ranked Salaries'01.0000202220832595413
Doctorate Adjusted Ranked Salaries'01.00002121023724877141
Doctorate Adjusted Ranked Salaries'01.000022175891239933
Doctorate Adjusted Ranked Salaries'01.0000231641182344149
Doctorate Adjusted Ranked Salaries'01.00002416190152197066
Doctorate Adjusted Ranked Salaries'01.000025  2050062
Doctorate Adjusted Ranked Salaries'01.000026  2045427
Doctorate Adjusted Ranked Salaries'01.000027  1705366
Doctorate Adjusted Ranked Salaries'01.000028  1672224
Expected Summarised Value  34093.8527125832666.458822210
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, milonsarker 

     

    You can try the following methods.

    Average of Teaching_Stipend = DIVIDE(SUMX('Table',[Teaching_Stipend]*[Teaching_Num]),SUM('Table'[Teaching_Num]))
    Average of Research_Stipend = DIVIDE(SUMX('Table',[Research_Stipend]*[Research_Num]),SUM('Table'[Research_Num]))

    Is this the result you expected?

     

    Best Regards,

    Community Support Team _Charlotte

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

5 Replies

  • Hi milonsarker 

    Please post a workable sample data (not an image) representing your use case and your expected result from that. For example, in your screeshot, what values do you expect?

    • milonsarker's avatar
      milonsarker
      Regular Visitor

      I've added the sample data. Also, original post already has the equation for weighted average stipend. 

    • milonsarker's avatar
      milonsarker
      Regular Visitor

      I've added the sample data. Also, original post already has the equation for weighted average stipend. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, milonsarker 

     

    You can try the following methods.

    Average of Teaching_Stipend = DIVIDE(SUMX('Table',[Teaching_Stipend]*[Teaching_Num]),SUM('Table'[Teaching_Num]))
    Average of Research_Stipend = DIVIDE(SUMX('Table',[Research_Stipend]*[Research_Num]),SUM('Table'[Research_Num]))

    Is this the result you expected?

     

    Best Regards,

    Community Support Team _Charlotte

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