Jump to content

Show the data in the Cross table even if there is no data on the selected date in Spotfire


Diana Arias

Recommended Posts

Hello! I created a vehicle accident case to ask this question.

I have a Date filter to filter the count of vehicle accidents. I'll show what I need using the Renault as an example:

In this case, I'm filtering the date: 11/08/2022, as you can see, the Renault appears because we have accidents:

image.png.22398b2a270a4b7b2a4221b5c3c6c9ea.png 

But in this case, if I filter the 11/07/2021 the Renault does not have accidents, so for that reason, the Renault does not appear:

image.png.caad19eb2d98d40e78111b3bfc7f6427.png 

What I need: Even though I select a date where a vehicle did not have an accident, I need to see all types of vehicles. In this example, I need to see the Renault in the type name list (this can be with a 0 or "-"):

image.png.c4041d15510a5a3ec880322254cd4171.png 

Link to comment
Share on other sites

Hello,

As you want to see values that don't exist in your filtered data, one approach could be to not actually filter your data, but to use the date of interest directly in the calculations for the plot instead.

In the example below, I created a Document Property (propDate) which contains the Dates from my Date column. At the top of the page, I added a drop down where you can select the Date you are interested in.

I use that property in the expression for the cell values in the Cross table:

Integer(Sum(If([Date]=DocumentProperty("propDate"),1,0)))

This expression just sums the values from all rows - 1 if the Date matches what is set in the document property, 0 otherwise)

Below, I have selected the Date 10/2/2022, and you can then see that it counts the 3 Volvo's for that date, and Renault has 0..

docprop.thumb.PNG.ef6b252d55b62244e3425e315326ab8c.PNG 

Another approach in a case like this can be to add "zero data" data. Here's an example of a script that does that:

IronPython script to Add Rows With Zero

https://community.spotfire.com/s/article/IronPython-script-to-Add-Rows-With-Zero

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...