Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Create an Calculated Member for survey scores in an MDX to show average total score per submitted form

$
0
0

Hi - I've been given a task building some vizes in Tableau using an Cube. I've had to quickly learn some MDX, but still a total novice. I'm connected, built some calculated members...but totally stuck.

I'm working with survey data - basically each Form ID has a load of attributes attached (Country, Team, Time etc). There are only ever 3 identical questions asked, and only 4 possible answers. Responders don't have to answer all questions so these will be NULL.

So far I've built these:

[Count of Answers] – so I can show volume of surveys answered:

IIF([Answer].[SAnswer].currentmember = [Yes], [Measures].[Number Of

Answers], (IIF([Answer].[SAnswer].currentmember = [Probably], [Measures].

[Number Of Answers], (IIF([Answer].[SAnswer].currentmember = [Maybe],

[Measures].[Number Of Answers], (IIF([Answer].[SAnswer].currentmember =

[No], [Measures].[Number Of Answers],0)))))))

And,

[Survery Scores]

CASE

WHEN [Answer].[SAnswer].currentmember = [Yes] THEN 1.00

WHEN [Answer].[SAnswer].currentmember = [Probably] THEN 0.67

WHEN [Answer].[SAnswer].currentmember = [Maybe] THEN 0.33

WHEN [Answer].[SAnswer].currentmember = [No] THEN 0.00

ELSE NULL

END

What I want to be able to do is report the average score per Form ID, at any level of my dimensions.

[Form ID].[001], has 3 questions answered: Q1 = 67%, Q2 = 67%, Q3 = 67% so average is 67%

[Form ID].[002], has 2 questions answered: Q1 = 100%, Q3 = 0% so average is 50%

So if both IDs were were in the same [Country].[Team].[Month] the average score would be 58%

I've tried using table calcs to get this and it doesn't work. I can get a visual showing a list of Form IDs, with a repeat of possible answers, and a count against each when answered. If I was using a flat extract, this would be easy as I'd use a level of detail calculation, but I can't because you can't use dimensions in Calculated Fields in Tableau with cube data. You can only use Measures and Calculated Members. Any assistance would be appreciated as I'm totally stuck at the moment. Thanks.


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>