SSRS 2012 Mean & Median

强颜欢笑 提交于 2019-12-25 04:59:17

问题


I have a report that i use Mean and Median measures that were calculated in SSAS 2012 tabular, the reports as follows:

when i use the Mean and Median directly, the values in the green box are correct and the column and row totals are incorrect.

after using aggregate instead of sum the following happens:

1- the blank row and blank column are now gone along with their values.

2- Then total of the Mean is correct in every cell except the grand total(2nd cell from right bottom corner), it appears to take the value of the cell given in Mean for the cross between blank and blank in previous pic.

3- The totals for the median are now either blank or 0 except for the grand total (right bottom corner cell), it seems to have the value for the Median from the cross of blank and blank in previous pic.

I am stuck here i dont know what to do and i want to avoid using another dataset if possible. HELP!!

A screen shot of my Query designer:

After including all empty spaces :

(=Aggregate is used on every cell), please note after taking away extra dimension columns, the Total row in the bottom changed , the correct Mean totals from pre-pic are now gone.

The MDX for the DataSet :

SELECT { [Measures].[INCOME AVERAGE], [Measures].[INCOME MEDIAN] } ON COLUMNS, {[DIM_Type of Education for Household نوع التعليم لرب الأسرة].[EDU_TYPE_ENAME].[EDU_TYPE_ENAME].ALLMEMBERS * [DIM_Nationality of household الجنسية لرئيس الأسرة].[NATIONALITY_L1_ENAME].[NATIONALITY_L1_ENAME].ALLMEMBERS, [DIM_Type of Education for Household نوع التعليم لرب الأسرة].[EDU_TYPE_ENAME].[EDU_TYPE_ENAME].ALLMEMBERS * {[DIM_Nationality of household الجنسية لرئيس الأسرة].[NATIONALITY_L1_ENAME].[All]}, {[DIM_Type of Education for Household نوع التعليم لرب الأسرة].[EDU_TYPE_ENAME].[All]} * [DIM_Nationality of household الجنسية لرئيس الأسرة].[NATIONALITY_L1_ENAME].[NATIONALITY_L1_ENAME].ALLMEMBERS, {[DIM_Type of Education for Household نوع التعليم لرب الأسرة].[EDU_TYPE_ENAME].[All]} * {[DIM_Nationality of household الجنسية لرئيس الأسرة].[NATIONALITY_L1_ENAME].[All]}, ([DIM_Type of Education for Household نوع التعليم لرب الأسرة].[EDU_TYPE_ENAME].[EDU_TYPE_ENAME].ALLMEMBERS * [DIM_Nationality of household الجنسية لرئيس الأسرة].[NATIONALITY_L1_ENAME].[NATIONALITY_L1_ENAME].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM [Model] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

Thanks in advance.


回答1:


Your MDX query includes a ton of fields. Can you simplify it to the following to see if it solves the problem:

+-----------+-------------+--------+---------+
| Education | Nationality | Median | Average |
+-----------+-------------+--------+---------+
| null      | null        |    100 |     110 |
| PhD       | null        |    100 |     110 |
| null      | Saudi       |    100 |     110 |
| PhD       | Saudi       |    100 |     110 |
+-----------+-------------+--------+---------+

Don't return any extra dimension columns.

I am using null to represent the All member which is now the MDX query designer does it. Hopefully just dragging and dropping Education and Nationality onto the grid in the graphical MDX query designer will get you what you want. There is a button that turns on showing the All member if I recall.

Row 1 is for the grand total in the very bottom right.

Row 2 is for the subtotal in the far right column.

Row 3 is for the subtotal on the bottom row.

Row 4 fills up the body of the Report.

Then change the layout of the Tablix so that the row group is on the Education column and nothing else. Change the column group to be on Nationality and nothing else. Make sure all the textboxes in your Tablix have =Aggregate. I am hopeful it should work now.



来源:https://stackoverflow.com/questions/43374786/ssrs-2012-mean-median

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!