multiple year comparison chart - charts

I am looking to create a chart in Power BI to compare weekly data from previous years to levels this year, similar to the screenshot below from excel.
5-years of historical data in the shade with this year as a line chart.
Have tried to use similar method to excel
take min and max figures from the weekly data
get the difference between the two values
in charting: take the min value and use stacked area to shade range above with the difference between the min & max
place this years data as a line chart

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

Tableau: Graph X on month with different year as colored lines

I'm trying to recreate the following Excel-created graph in Tableau. My data has traffic organized by month-year Eg., 01-01-2016, 02-01-2016 ...etc. for each year. Would changing the data format be required, or can I work with this as is?
I'm following the tutorial here but the closest I can get is:
There are two ways to accomplish this easily.
1. Change the marks card type from Automatic to Line.
Use Show Me (upper right) and select the icon for the line chart.
Additionally, here is some information on Discrete vs Continuous Pills which cause many new users confusion.
Discrete = Distinct buckets like apples, oranges, peaches, etc
Continuous = Any values on an axis like percentage, sales, etc
For dates, discrete dates are parts of the month like days (1, 2, 3...), months (Jan, Feb, March...). A continuous date would be Jan 2019, Feb 2019, etc (these are truncated dates because they include the entire date starting from earlier in time to later in time.
In the picture, the list in green is continuous and the list in blue is discrete.

Tableau average line on chart of averages

I have a bar plot with average values for some dimensions, let's say: weekdays. Now I want to put an average line on it - I use Analytics > Average Line. The line I get doesn't show the average for all data examples though, but the average counted from the aggregated values on the plot (avg from 7 values).
Can I get somehow the other one?
Put whatever your [Value] field is called on the Detail shelf. Then double click on it to edit it on the shelf
Change the expression to Total(Avg([Value])) where Value is the field you are displaying
Use this field for your average line, Read about Total() in the documentation. You may also need to edit the table calc addressing and partitioning characteristics to scope your total as desired (although the default settings often work) Read about Table Calcs in the on-line help for more info

Tableau: how to count by year?

I'm new to Tableau. I have a dataset with video games and the year they were released. I would like to make a distribution of the games released per year.
The x-axis is the years, but the y-axis should be the count of the times that year was mentioned as the release date. I can't seem to figure out how to do this.
Is there also a nice way to make intervals for every 5 years instead of plotting all the years?
If you drag your [Release Date] to columns and the [Number of records] measure to rows, you will get exactly what you want.
If you want to group the years the easiest way would probably be to create a calculated field (right click on a dimension/create/calculated field) with the following formula:
div(year([date]),5) * 5
Which will give you the years from 1990-1994 as 1990 and so on.
If you drag this into columns instead of the release date you have your grouping.
You can use the histogram bins feature in Tableau to easily combine nearby years into a single bin.
In the data pane on the left side bar, right click on your Year field and use the Create submenu to Create bins. This will create a new field called Year (bins) that maps year to bins (blocks) of years.
Right click on the Year (bins) field and set the bin size to 5 (or whatever number of years you prefer)
Now you can use Years (bin) on the column (or any other) shelf as you like. You can also change it from discrete to continuous if you like depending on how you want the data presented.

Aggregating data from the US stock market in Tableau, using different time frames

I am a very basic user of tableau and I have not found an answer to my question.
I have a txt file that has historical daily data for 98% of all the stocks in the US, with their daily capitalization. Each stocks has its TICKER, Daily Market Value for every trading day of the year, and its SECTOR.
I did a simple time series that display SUM([Mktval]) (sum of all individual market values) across all stocks, on a daily daily, and where I can see that the total value as of 2016 is about 24 Trillion USD, as in the image below.
When I change the view column from DAY to YEAR, I don't see the right values, but something a lot larger. So I realized that I need to do SUM([Mktval])/252 to get the right value for a year (there are 252 trading days in a year).
If I change the view to MONTH, as in the chart below, the numbers are again wrong because 252 is not the right value to use in the division.
Is there any way that Tableau can adjust the values automatically to reflect the AVG MktVal across different time intervals?
Thanks
Replace SUM(Mktval) on the Rows shelf with the following calculated field
avg({ fixed day(Date1) : sum(Mktval) })
That solution is all in one step. It is perhaps a bit more clear to use 2 steps. First, create a calculated field called total_daily_market_value defined as
{ fixed day(Date1) : sum(Mktval) }
Then make sure that calculated field is a measure. It is an LOD calculation that you can think of as a separate table with one value for each day showing the total market value for that day.
Drag that measure to a shelf, and then change the aggregation function to AVG(), MEDIAN(), MIN(), MAX() or STDEV() as desired. Tableau will aggregate the total_daily_market_value using your chosen aggregation function for whatever values of Date1 are in your view.