Display only one category as a percentage/proportion of total

I have a Looker table with number of negatives and positives per month. I need my visualization to show only the positive rate (either as a percentage or proportion of total positives and negatives).

Looker can easily plot the percentages of both negatives and positives on the same graph, but if I "hide" negatives, the positive percentage balloons to 100%. Thats not right. I want to plot the actual positive percentage out of total. 

Is there a visualization option or table calculation I could use to achieve this?

Here's what my data currently looks like:

Status (pivoted)NegativesPositives
MonthCount Distinct CasesCount Distinct Cases
month_137
month_242
month_315
month_455

Ideally my data would like this and I could plot the Positive Rate (as proportion or percentage):

Status (pivoted)NegativesPositives 
MonthCount Distinct CasesCount Distinct CasesPositive Rate
month_1370.7
month_2420.33
month_3150.83
month_4550.5
Solved Solved
0 2 51
1 ACCEPTED SOLUTION

Maybe the pivot is giving trouble.

Try creating a filtered measure on the count distinct cases directly. Pass filter condition to identify positive cases from them. Then create another % measure from this new field (the option would be % of column). This will create a field to calc % of positive cases.

Now hide the previous measure column so that only month and exact % fields can be used to show in the Viz. 

View solution in original post

2 REPLIES 2

Maybe the pivot is giving trouble.

Try creating a filtered measure on the count distinct cases directly. Pass filter condition to identify positive cases from them. Then create another % measure from this new field (the option would be % of column). This will create a field to calc % of positive cases.

Now hide the previous measure column so that only month and exact % fields can be used to show in the Viz. 

So this worked ! (with a minor modification to the final step). In the final step I want percentage of row, not column. You need a table calculation to do that.

Here's the raw data:

MonthCount Total Cases
month_110
month_26
month_36
month_410

Then create filtered measure on Count Total Cases where I grab the positive cases. So the data then looks like this:

MonthCount Total CasesPositive Cases
month_1107
month_262
month_365
month_4105

Then create a new table calculation where I calculate the proportion of Positive Cases out of Total Cases: ${positive_cases} / ${count_total_cases}}

That gives you this final format, where you can plot Positive Yield:

MonthCount Total CasesPositive CasesPositive Yield
month_11070.70
month_2620.33
month_3650.83
month_41050.5
Top Labels in this Space