Reputation: 3
Im working with a dataset to heart failure. It contains four tables and I want to create a dashboard that revolves around exploring how different afflictions affect blood values, sex (male, female) and age. These afflictions are, for example, diabetes, smoking, high blood pressure, etc.
In this dataset, those columns are booleans. That is, Diabetes can either be 1, if the person had it, or 0 otherwise. The same happens to the column of death events. If the person died during the study, the value is 1, or 0 otherwise.
Then, I have something like:
Unique ID | Value 1 | Value 2 | Anaemia | High Blood Pressure | ... | death_event
1 | 0.484 | 1.354 | 1 | 0 | ... | 0
Which means that particular person had anaemia, but not high blood pressure and didnt die, along with different blood values and other data.
What I want is to create a filter like the following:
And when I select one of the column names, a pie chart would adjust accordingly, showing the proportion of deaths and alive people that had that affliction within the dataset.
Kind of desired result, could also be a bar plot
To try to solve my issue I did a little bit of research and found that I could use a Parameter (which is what I used to create the filter shown in the first image) and combine it with a Calculated Field, but I also need the aggregation: show the amount of dead and alive people with that condition within the dataset.
I tried the [Affliction] = [Affliction Parameter] method, but that doesnt work since I need multiple columns and also an aggregation.
I also tried to work with calculated fields of the type:
calculated field to match string contidion
but at this point Im lost.
Thanks in advance for your help.
Upvotes: 0
Views: 515
Reputation: 16
Here's a way to do this. Create a parameter called [Sort Metric] Select String and list. Type the names of the two or more fields in the list names. Let's say one is [Sales] and one is [Customer ID]. Create a calculated field [Sort by Metric]
IF [Sort Metric]='Sales' THEN SUM([Sales])
ELSEIF [Sort Metric]='Customer ID' THEN COUNTD([Customer ID])
END
Show the parameter in the view or dash. rt-click the pill that you want to sort. Choose by field select [Sort by Metric] Ascending or descending.. Aggregation should be "Custom" Switching the parameter will use the other aggregation.
Upvotes: 0