Tableau: How to divide two table calculations? - tableau-api

I have these calculated measures which I use within a tool tip as table calculations
[alert_count_by_action] = total([distinct_alerts]) compute using day
[alert_count_all] = total(distinct alerts]) compute using table across
When I mouse over an action name colored widget type I can see that the [alert_count_by_action] and [alert_count_all] are producing the correct values. What I would like to do is to compute a percent by dividing [alert_count_by_action] / [alert_count_all] which I will call [alerts_by_action_percent_overall]. This is not working at all despite trying every combination available on the table calculation options within the Marks card.
What am I doing wrong?

Without the attached workbook, I can only suggest to check the partitioning of your % calculation. Because both components of the fraction are themselves table calculations, they can be partitioned separately (i.e. "compute using" options).
There should be a combo-box in the 'Edit table calculation' dialog that selects which component is being configured.
Maybe you have configured one part, but not other?

Related

Power BI dynamic Filters on group by

Im fairly sure what im attempting is not the ideal way to do things due to my lack of knowledge of power BI but here goes:
I have two tables in the form of:
One has the actual power against wind and the other is a reference
I created calculated columns that add a corresponding binned speed to each row (so 1-2, 2-3, 3-4 etc)
I have filters and slicers applied on the page / visual that will keep changing.
What i want is to create a pivot or a grouped table that is changed dynamically based on my filters.
The reason i want this is currently the table ive got has totals that are averaged (because individual row is averaged) but i want a sum of an average by category. If i can have this as a calculated table instead of a visual (picture below) i would likely be able to aggregate this again to get what i want
so on the above table i want to totals to be sum of individual rows. I also want to be able to use these totals to carry out other calculations (simple stuff like total divided by fixed number etc)

Form data evaluation

I have a form data wherein tableau I am using the below value to find out the choices for a multiple value question. The question is Could you please indicate one or two areas where we fell short.
the value can be explosives, vehicles, cement etc
I have individually accounted for each of the choices in the below calculated field:
int(contains(lower([Could you please indicate one / two of the following areas where we fell short of meeting your expectations?]),'factory'))
Similarly I have found out for other values:
The calculated fields are hasvehicle, hasfactory etc
But the problem is how can I visualize the same in the form of bars?
All I am able to do is this:
How can I visualise the same in the form of bars side by side?
When you have one measure on Rows, drag the second measure and drop it in the axis.
It will result with Measure Names on the Columns shelf and Measure Values on the rows shelf.

Displaying change in moving average on map

I am trying to show the change in moving average by county on a map.
Currently, I have the calculated field for this:
IF ISNULL(LOOKUP(SUM([Covid Count]),-14)) THEN NULL ELSE
WINDOW_AVG(SUM([Covid Count]), -7, 0)-WINDOW_AVG(SUM([Covid Count]), -14, -7)
END
This works in creating a line graph where I filter the dates to only include 15 consecutive dates. This results in one point with the correct change in average.
I would like this to number to be plotted on a map but it says there are just null values.
The formula is only one part of defining a table calculation (a class of calculations performed client side tableau taking the aggregate query results returned from the data source)
Equally critical are the dimensions in play on the view to determine the level of detail of the query, and the instructions you provide to tell Tableau how to slice up or layout the query results before applying the table calc formula. This critical step is known as setting the “partitioning and addressing” for the table calc, sometimes also as setting the “compute using”. Read about it in the online help for table calcs. You can experiment with using the Edit Table Calc dialog by clicking on the corresponding pill.
In short, you probably have to a dimension, such as your Date field to some shelf - likely the detail shelf, and the set the partitioning and addressing, probably to partition by county and address by state.
If you have more than a couple of weeks of data, then you’ll get multiple marks per county. You may need to decide how to handle that on your map.

Tableau Percent Difference Between Week

I am trying to display a graph that shows the increase or decrease in percentage of calls from each country over time (sample data and desired output below). This is intended to answer the question, "Has the proportion of calls within the USA compared to the others gone up or down in the past week?", not to be confused with answering the question if USA has just seen more calls.
In the example below, I am looking for a bar chart that shows increases/decreases for all of the countries (x-axis = country, y-axis = percent difference)
I understand how to do this based on a simple change in count, but am struggling to look at this as percent of the total.
Sounds like you want to do a Table Calc on a table calc. No problems to do this. I suggest creating the first calculated field and saving it as a new calculation. Then use that field within your final table calculation.
If you're creating the table calculation using the Quick Table Calculation, double click in the pill to see the underlying formula - you can copy this out and paste into a new calculated field.
You are also able to set the "Compute Using" separately using this method, which may be useful in this example.

Adding average lines to Tableau bar chart

I have a Tableau bar chart which plots a number of measures for one particular row at a time in my data set (using a Quick Filter).
I was wondering if there was an easy way to add a reference line for each measure's average value across the entire data set.
You may have to bring in more data and use an alternative filtering method to 'quick filter' (like using a conditional expression in a calculated field). Such as:
if (condition of quickfilter) then
data
else
null
end
this way you can view only limited rows of data in your viz, while also bringing in the rest of the data for the average calculation.