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 :)
Related
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
I have a bar chart sorted by year over year percentage difference and I have excluded values that are too large (over 400% year over year difference) . I want to show the top 5 for each category using a parameter variable("TopN"). The bar chart shows less than the allocated parameter amount (5) for some of the categories selected even though there are values there. I used the following code below.
if [index]<=[TopN] THEN "Top N"
ELSE
IF [index]>=SIZE()-[TopN]
THEN "Bottom N"
ELSE
"Middle"
end
END
When I remove the filter to remove the too large values I mentioned above I am able to see the correct number but I don’t want those values to be shown and want to see the top without the large values(outliers).
I used sets to exclude the values that were too large. And that worked for me. It removed the large values and when I applied the top N filter. It now it gives me what I was looking for.
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
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.
I am using Crystal 9 and have created a report showing calls logged by users, time taken to close the call, Solved with (allocated a value to the latter field depending on time taken eg. 1-59 mins = < 1 hr = 1), 60-239 mins = < 4 = 4. I have then grouped the results by users and got totals for each of the Solved values
Solved1 = solved in less than 1 hour
eg group total shows (when record data hidden)
User1 (Total Calls= 74) (Solved1 = 42) (Percentage1 = 56.76)
User2 (Total Calls= 17) (Solved1 = 2) (Percentage1 = 11.76)
Total Calls and Solved1 are obtained using Running Total Fields.
Percentages are Formula fields and calculated as follows:
Percentage1 = Solved1/Total Calls * 100
My problem is that I need to graph the percentage values for each user for each Solved value eg. 56.76 and 11.76 on one chart. This would be easy except that Crystal doesn't let me select this field in the chart option because it's calculated from two Running Totals.
Since some formulas are accepted by the Chart expert and running totals are also accepted, is there a way I can calculate the percentage which it would find acceptable? Or can I put the total and Solved value in the chart and have the chart calculate the percentage somehow? I was looking at using count and I can get the count to count all the records for a single person but not where say the value in a specific field = '1'
eg count (call_id, )/count (call_id, closedby) * 100
Does anyone know how I can write that fomula or any other way of graphing a percentage?
You can do this using Crystal formulas.
Set up a formula for Solved1 - something like
if {myTable.timeTaken} < 60 then 1 else 0
Next, set up a formula for Percentage1 - something like:
100*sum(#Solved1,{myTable.closedBy}) / count({myTable.call_id},{myTable.closedBy})
Drag and drop the formula for Percentage1 onto the report layout, then you should be able to add it from Report Fields onto your graph in the Data tab of the Chart Expert. (You may then want to remove the Percentage1 formula item from the report layout.)
I ran into a similar issue trying to graph On Time Delivery percentages.
I have three percentages to display: On Time, 1-3 days late, and over 3 days late.
I was in need of displaying zero percents as well, i.e. when there were no records that were "1-3 days late" I still needed to show 0% as one of my bars. The above did not address that. I ended using this resolution with a twist.
I created 4 formulas:
one to return 1 if the record was on time else 0
one for the 1-3 days,
one for the over 3 records.
one for each record returning a value of 1.
With that I was able to create my percentage fields using the Sum of one of the first 3 formulas divided by the sum of the "1" formula. Crystal would not work if I used the Count(...) function on a key field. It only worked when using the Sum(...) function in my percentage formulas.