How to get average column value in SSRS

I have a table like this.

Data table

And I want to use SSRS to report as follows.

Report

I use the Matrix in this report. Add [Category], [Commodity] to the row group, add [SaleDate] to the column group, add Sum (SaleAmount) to the column data, add Sum (SaleAmount) for the [Product] row group, add Avg (SaleAmount) to the last cell.

enter image description here

But the value of Avg (SaleAmount) is not like (3 + 5 + 2) / 3 = 3.3333, its value is (2 + 1 + 3 + 2 + 1 + 1) / 6 = 1.666666 ....

enter image description here

Can anyone help me? Thanks!

+4
source share
1 answer

, . , , . CountDistinct :

=SUM(Fields!SaleAmount.Value) / COUNTDISTINCT(Fields!Commodity.Value)
+7

Source: https://habr.com/ru/post/1524934/


All Articles