Power BI dynamic Filters on group by - 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)

Related

Power Bi Clustered Column Chart to show % or row total

I am using Power Bi to produce several reports, one of it is the NPS score for support. However, I am coming across an issue with the clustered column chart. It is showing the value against the total number rather than for each row.
What I want to see if the following (within Excel),
The NPS score is shown as a percentage for each week.
e.g. Week 3 has the Promoter at 95.5% and Detractor at 4.5%
However, when using Power Bi, I am shown the following, which is a Percentage of the grand total, instead of each week.
Using a Matrix, I could see the following as total numbers.
I can copy this Matrix and show it as a Percentage of each Row, which is also correctly showing the results.
I have the dates already set up using a feeder table to allow me to get the week number etc from a date within the main raw data, so they sort in the correct order..
My Chart is using the following table entries
Cal Week and WeekNo are both from the feeder table (Fiscal)
Net Promoter and Count of Case Num are from the RawData table.
How can I get the chart to show the percentages per week instead of the total?
I am also planning to use slicers to filter down further, for example, Regions (which are in the RawData).
I believe I will need to add an extra column to the RawData, but no idea what to put in it and then how to use that in the chart, and still allow it to slice.
Any help would be greatly appreciated.
Thanks
DD

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 Dual Axis with different filters

I am trying to create a graph with two lines, with two filters from the same dimension.
I have a dimension which has 20+ values. I'd like one line to show data based on just one of the selected values and the other line to show a line excluding that same value.
I've tried the following:
-Creating a duplicate/copy dimension and filtering the original one with the first, and the copy with the 2nd. When I do this, the graphic disappears.
-Creating a calculated field that tries to split the measures up. This isn't letting me track the count.
I want this on the same axis; the best I've been able to do is create two sheets, one with the first filter and one with the 2nd, and stack them in a dashboard.
My end user wants the lines in the same visual, otherwise I'd be happy with the dashboard approach. Right now, though, I'd also like to know how to do this.
It is a little hard to tell exactly what you want to achieve, but the problem with filtering is common.
The principle that is important is that Tableau will filter the whole dataset by row. So duplicating the dimension you want to filter won't help as the filter on the original dimension will also filter the corresponding rows in the second dimension. Any solution has to be clever enough to work around this issue.
One solution is to build two new dimensions that use a calculation rather than a filter to create the new result. Let's say you have a dimension, [size] that has a range of numbers from 1 to 10 and you want to compare the total number of rows including and excluding the number 5. You could create a new field using a formula like if [size] <> 5 then 1 else 0 end
Summing the new field will give a count of the number of rows that don't contain a 5 and this can be compared directly to a rowcount of the original [size] field which will give the number including the value 5.
This basic principle can be extended to much more complex logic. The essential point is to realise that filters act on every row in your data and can't, by themselves, show comparisons with alternative filter choices on a single visualisation.
Depending on the nature of your problem there may be other solutions worth looking at including sets and groups but you would need to provide more specific details for users here to tell you whether they would be useful.
We can make a a set out of the values of the dimension and then place it in the required shelf. So, you will have your dimension which will plot accordingly and set which will have data as per the requirement because with filter you can't have that independence of showing data everytime you want.

Want to visualize a cumulative value of a quotient of two variables from the beginning in Tableau

I'm looking forward to create a parameter or calculation in Tableau that allows me to get a kind of running total of a quotient of two variables.
Let's explain this with a simple example using baseball jargon:
Let's consider that a batter starts a season registering both At Bats (AB) and Hits (H). The Batting Average (BA) is defined as H/AB. All these values are available in my data set on a game basis (each row of the dataset is a game).
I need to calculate the cumulative Batting Average of the batter since it started to play.
The following table/image shows how this can be done in Excel adding some other columns, but I want to create that directly in Tableau using a calculation.
Example data in Excel
Both averages (by game and cumulative) in a Excel graph
You can use RUNNING_SUM on At bats and Hits. And then divide [hits] / [at bats].
See attached: https://dl.dropboxusercontent.com/u/60455118/160716%20stack%20question.twbx