How do I show multiple lines on the same graph in tableau? - tableau-api

I have my graph set up, so that a sum total is in rows, and month is in columns. I would like to see the last three years as separately colored bars or lines in the same graph. I created sets for 2014,2015, and 2016, but for some reason can not get it to do what I have described above.
Thank you.

One way would be to create a calculated field that "groups" those 3 years into one value/label, then use that in the colors card.
The calculated field may look something like:
IF [YearField] >= 2014 AND [YearField] <= 2016 THEN 'Last 3 Years' ELSE STR([YearField]) END

Related

Looking for YOY YTD formula that works with fiscal years in tableau

I am looking for YOY YTD formula that works with fiscal years in tableau.
Method 1 appears to work here: https://resources.useready.com/blog/ytd-cy-vs-py-in-tableau-2-methods/ but does not work for Fiscal years.
the current year filter starts at Jan.
Is there anyway to adjust method 1 to work with fiscal years?
Note: i tried default properties-> fiscal year start to July and that did not work
See "goal in tableau screenshot below"
You're almost there, assuming you computed what you're showing in Tableau
and didn't just mock it up in Excel.
If you don't have one, create a calculated field "FY-Number" where
January -> 1, Feb -> 2, etc. You're already sorting in that order
so maybe you already have such a field.
Assuming your "average" is a "total" ( using AVERAGE ),
all you need now is a filter to select FY-Number < 7.
Which you COULD do manually.
But if you want this to be automatic, and always total down to the most recent month, you could do the following. There may be better ways but this works.
And I have a hierarchy of FY-number and Fiscal-Month-number for generating the grid.
Compute a running number which we can maximize, a sequential number crossing all years, for the month. I used formula for FMRun to be
[FY num]*12 + [FM num]
which has a max of 270 for December 2021. Tableau can find the max.
Next, invert that, basically, to find the max month number.
FMInvert formula:
{FIXED :(MAX([FMRun])/12 - FLOOR(max([FMRun])/12))*12}
which has a value of 6 for the data given.
Finally, filter on that with this filter I called whatmax, which we want true:
if [FM num] <= [FMinvert] then TRUE
else FALSE
END
And voila, you're done.
Here's the workbook.
https://public.tableau.com/app/profile/wade.schuette/viz/YOY-YTD-answer/Dashboard1?publish=yes

Spotfire: Empty values on x-axis

Spotfire question: I have a data table with monthly data that is visualized in a bar chart. I however also want to visualize the information in quarters, by showing the latest month of the quarter in the format '20Q1, 20Q2, etc.'. (So I don't want to use standard 'date format'.)
My idea was to create an additional column that is filled for March, June, Sep, Dec and empty for the other months. Then with a document property, the user can select to either view the data in months or in quarters (i.e. the last month of the quarter).
So far so good, my data now looks like this:
Month
Value
YearQuarter
Jan-20
100
Feb-20
200
Mar-20
400
20Q1
Apr-20
125
May-20
101
Jun-20
300
20Q2
The problem now is that when I visualize the data with YearQuarter on the x-axis, it also shows all the (empty) values in a bucket. See below. How to solve this? Note that the x-axis has a custom expression "<$esc(${Granularity})>", where Granularity is a document property to determine what column to pick.
Did you try limiting your data with whatever expression you have put in x axis.
Thanks

Tableau layout for multiple charts on one worksheet

I have 15 pie charts on one worksheet (one for each year since 2006). At the minute I can either have them in a vertical line or a horizontal line but I want to have them in 3 rows of 5, how do I go about doing that?
Thanks in advance (from a Tableau newbie) !
What you're looking for could be a tecnqique that consists in creating two additional calculated field for row_indicator and column_indicator.
So assuming you have a pie for each product_category you could create something like this for rows:
if prdocuct_category in ('a','b','c','d','e') then 1
elseif prdocuct_category in ('f','g','h','i','j') then 2
else 3
end
Once you've done the same for columns, you can use those two fields in the worksheet as first field in row/column shelf.
Otherwise, you can check the small multiple technique which is more or less the same and splits your by in groups according to the square root.
Check this tecnique in this video:
https://www.vizwiz.com/2016/03/tableau-tip-tuesday-how-to-create-small.html

Spotfire visualization - Over in a running total gets blank values?

I have built a bar chart visualization with Spotfire that includes the use of the Over function to give a running total. Months are on the X axis and counts are on the Y axis.
My data set contains months where there were no values. When I graph that there is no bar although a running total should still contain a value although zero was added for that month.
How do I get a month with no value to still show a bar for that month?
Yes, You can try Count() OVER (AllPrevious([Axis.X])), this will work for bar chart and line chart. or if you r using 55.0 and above version you can use Cummulative function which is inbulit is recent versions.
Hope this help :)
Here is my data set (note the 2 missing values):
Month Value
Jan-14 1
Feb-14 2
Mar-14
Apr-14
May-14 5
Jun-14 6
Jul-14 7
Aug-14 8
Sep-14 9
Oct-14 10
Nov-14 11
Dec-14 12
Here is my expression (taken from the built in Cumulative function):
Sum([Value]) THEN Sum([Value]) OVER (AllPrevious([Axis.X]))
Here is my result:
So it looks like your expression is wrong.
since I saw this old topic and didnĀ“t find a solution at first, there it is:
the formula is good, but displaying the months with no values is an option of the bar chart itself.
Go to the bar chart "Properties", then "Appearance", then at the bottom of the window: tick the box "Compensate for missing values".
Hope this will prevent next users from searching in the future :)

How do I achieve a multi-series line chart in Crystal Reports?

This relates to my How do I achieve a pivot report in Crystal Reports for Visual Studio? The data is the same, but they want a line chart as well.
So, my data is {datetime}, {car-id}. The X -axis of the chart must show the hour of {datetime}, the Y axis the number of cars that entered the park at that hour, and I must have seven data series, lines, one for each day of the week. So, e.g. the x/y point on the green line shows that on Wednesday, at hour x, y cars entered the car park.
Common sense tells me that I can kludge this by transforming the data source so that each day has its own column in a table, a table like this:
DateTime
WeekDay
CarCount
Yet the Crystal line chart doesn't seem to support more than one column, so there must be a different and better way of doing this. The weekday is part of {datetime} after all.
How can I achieve this chart? I am a rank amateur at charting, and Crystal's idiosyncrasies really aggravate my lack of skills and experience in this area.
It's not obvious how to get multiple series to show up properly.
First, create a formula that will extract the day of week from the datetime: dayofweek({datetime}) and then create another that will extract just the hour: hour({datetime}).
From there, insert a chart from scratch and make the following settings in the Chart Expert
Select "Line" under the Type tab
Under the Data tab, select "On change of" and select your {#HourOfDay} formula first. This will create each hour as a point on the X-axis.
In that same spot, also insert the {#DayofWeek} formula. This will create a new line
for each day of the week. This is, in my opinion, the non-obvious part.
Finally, to pick your Y-axis values,
select {car-id} where it says "Show value(s)". It should default to
the count summary of that field.
(Note: in the screenshot below, you would just replace {Customer.Customer_Name} with {car-id}
I had this issue for 5 years and finally solved it. I have a XY chart with multiple series.
Everything needs to be in a formula.
The graph should be in the report header section of a subreport. The sub report generates the X Y data like this:
Series X Y
Ser1 2020 1
Ser1 2021 2
Ser2 2020 0
Ser2 2021 1
For me I have as series "Energy" ie 6, 9, 12 etc.
Then I have a date/time and a measurement.
On change of (Energy formula)
Show Values
#1 DateTime (convert this to int ie 2000.9 for 9/2000) - dont summerize
#2 Measurement (number) - dont' summerize
Then you can do the color highlighter to capture your series (6 is red etc).
The legend won't work - can't figure out that yet.