Reputation: 13
I'm looking to compute the ratio of one dimension member with others. My dataset looks something like this,
Name Role City Country
ABC Admin XYZ PQR
DEF Marketing ZZZ YYY
GHI Admin PPP RRR
Assuming I create a Parameter with the list of roles, If I select Marketing, I need show there are 2 Admin people for every Marketing person in the company.
Upvotes: 1
Views: 1413
Reputation: 26218
I think you want to show the ratio of roles dynamically, as per user selection. The data provided was very less, therefore, I have used the following sample data-
Name Role
abc admin
def admin
gf manager
asdf manager
asdfg manager
jhjh assistant
ut assistant
ii assistant
eqw clerk
fvvf clerk
egrthh clerk
svfvf clerk
etgw MTS
Now proceed as follows-
Step-1 right click Role
field and create a parameter. Based on all values it has, a parameter will be created automatically e.g. Role Parameter
.
Step-2 Create a calculated field desired ratio
with the following calculation
{FIXED [Role]: COUNT([Name])}/
{MIN(IF
[Role]=[Role Parameter]
then {FIXED [Role]: COUNT([Name])}
END)}
Step-3 create one more calculation field (optional) with the following calculation
[Role]=[Role Parameter]
Step-4: Build your View drag Sum(Desired Ratio)
to columns shelf
and text
marks card, Role
to rows shelf
, optional field
to color marks card; you'll get a desired view like this-
Whenever you'll select a role from role paramter
the view will update
A little tweak in text
and tooltip
can give you a nice dashboard like this
I think this should solve your problem. Good luck
Upvotes: 1
Reputation: 11896
Here is one way, takes advantage of the fact that the type conversion function Int() converts True to 1 and false to 0
SUM(INT([Role]=“Admin”)) / SUM(INT([Role]=“Marketing”))
Alternatively, you could just make a table showing the Count of records for each role, and then use a quick table calc to compute percentages of the total.
Upvotes: 0