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
v-nankh
Frequent Visitor

Calculating difference between Average(Weightd_Avg) and Average(Previous_WeightedAvg) in Subtotals

I am creating a PowerBI Report with 3 number columns which basically has Weighted Average, Previous_WeightedAvg and Delta.  I have calculated all these 3 in SQL. The weighted average and previous_weightedAvg is calculated based on the rating and weight for each NIST category and subcategory against Microsoft's various Services when the service was refresh currently and the last time. The rating could be "1,2,3,4,NA"

 

Currently this report is being generated manually in excel. Please find below the view:

Capture.PNG

 Asset Management is the category and it has 6 subcategories. Eac of them have respective values for Weighted_Avg, Previous_WeightedAvg and Delta (Weighted_Avg - PreviousWeighted_Avg). The number in color blue is the Average of (Weighted_Avg), number in green is the Average of (Previous_WeightedAvg). I can obtain these numbers easily in PowerBI by selecting Average and Subtotals. However the number in yellow is not the average of (Delta). It is the difference between the number in blue and number in green. 

 

I have to create same view in PowerBI matrix. It is possible to have Average of numbers in 2 columns and difference in the third column  (Delta) at Subtotal level?

 

Please help!

 

Thanks,

Nancy

 

 

 

5 REPLIES 5
v-chuncz-msft
Community Support
Community Support

@v-nankh,

 

If you are not familiar with the measure, create a calculated table to summarize data first.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msftThanks! But it's not working. 

Can you please elaborate on the measure part?

@v-nankh,

 

Share us a simplified model so that we could provide the suitable formula.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft,

 

I am getting the value of Weighted_Avg and Pre_WeightedAvg by using the formula from the below link which contains another question of mine. 

 

Weighted and Previous Weighted Avg Calculation

 

Below is the snapshot from the PowerBI matrix that I currently have. 

Weighted_Avg,Pre_WeightedAvg and Delta I am calculating in SQl but using the below measure because because weighted_avg is a number field but it can have NA: 

Weighted_Avg_NA = var myAvg = AVERAGE(RatingsDelta_NIST[Weighted_Avg]) return if(ISBLANK(myAvg),"NA",myAvg)

Pre_WeightedAvg = var myAvg = AVERAGE(RatingsDelta_NIST[PreviousWeighted_Avg]) return if(ISBLANK(myAvg), "NA",if(myAvg = 0,"",myAvg))

Delta_NA = var myAvg = AVERAGE(RatingsDelta_NIST[Delta])return if(ISBLANK(myAvg),"NA",myAvg)

Capture1.PNGIn the above fig Business Env is the Category and the rest 1-5 are its subcategories. In Weighted_Avg column value 3.20 is the average os Subcategories weighted_avg = ( 3+2+4+4+3)/5 and similarly for pre_weightedavg.

Currently the delta formula that I am using is not giving me the right result for Category Difference (Circled in red in above fig). 

 

Any help?

 

Thanks,

Nancy

 

 

 

 

 

 

v-nankh
Frequent Visitor

I am creating a PowerBI Report with 3 number columns which basically has Weighted Average, Previous_WeightedAvg and Delta.  I have calculated all these 3 in SQL. The weighted average and previous_weightedAvg is calculated based on the rating and weight for each NIST category and subcategory against Microsoft's various Services when the service was refresh currently and the last time. The rating could be "1,2,3,4,NA"

 

Currently this report is being generated manually in excel. Please find below the view:

Capture.PNG

 

 

 

 Asset Management is the category and it has 6 subcategories. Eac of them have respective values for Weighted_Avg, Previous_WeightedAvg and Delta (Weighted_Avg - PreviousWeighted_Avg). The number in color blue is the Average of (Weighted_Avg), number in green is the Average of (Previous_WeightedAvg). I can obtain these numbers easily in PowerBI by selecting Average and Subtotals. However the number in yellow is not the average of (Delta). It is the difference between the number in blue and number in green. 

 

I have to create same view in PowerBI matrix. It is possible to have Average of numbers in 2 columns and difference in the third column  (Delta) at Subtotal level?

 

Please help!

 

Thanks,

Nancy

 

 

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.