Global Filter Overrides the Hard coded Date Range

Hello everyone,

I've been working on a Kibana dashboard to track item expirations over time. I created a Visualization table that displays the Date Range, Item Name, Item Location, Item Expiry Date, and Quantity. Specifically, I've fixed the Date Range to show items that expire within the last 90 days using 'now-90d' to 'now'.


However, I've encountered a challenge. When I apply dashboard filters, it overrides the visualization and the entire quantity changes. I attempted to address this by using TSVB and ignoring global settings, but the table's look and feel weren't quite what I needed.

I'm seeking guidance on how to ensure that the time period (last 90 days) and quantity remain constant even when I apply filters in my Kibana dashboard. Any insights or suggestions on achieving this would be greatly appreciated.

Thank you in advance for your help!

Any panel on a dashboard can be configured with a custom time range so you may want to set up your table with a very long time range so it is never affected by the global time range selector.

On the following example I have a table with a couple of date ranges and I duplicate it to customize the time range on the second to show how it is not affected by the changes in the time selector.

Peek 2023-09-04 16-53

Hi, Many thanks for the message. For the past 90 days, it's been working fine, but when I am doing it for the Next 90 Days, it gives me an absurd number. Attached is the image of the same.

The video that you have pasted is of the 8.9.1 version, whereas I am using the 8.7.1

But if you will see it from the Table view, you can see that the count of the Top Right Pane, has the actual number, whereas in the down pane, the number showing is not correct.



That feels weird.

I created a very minimal test just to be sure the custom time was working:


# Clean up
DELETE discuss-342090

# Create index
PUT discuss-342090
{
  "settings": {
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "expiry": {"type": "date"}
    }
  }
}

# Add some data in the past and the future
POST discuss-342090/_bulk
{ "index": {} }
{ "expiry": "2023-09-01" }
{ "index": {} }
{ "expiry": "2023-09-01" }
{ "index": {} }
{ "expiry": "2023-09-01" }
{ "index": {} }
{ "expiry": "2023-09-10" }
{ "index": {} }
{ "expiry": "2023-09-10" }
{ "index": {} }
{ "expiry": "2023-09-10" }
{ "index": {} }
{ "expiry": "2023-09-10" }

# Create a Kibana Data View
POST kbn:/api/data_views/data_view
{
  "data_view": {
    "title": "discuss-342090",
    "timeFieldName": "expiry"
  }
}

And created a dashboard with the same count metric with custom time ranges in the past and future, all working as expected.

So at this point, if you could share some example data similarly to the way I did so we can try to reproduce the issue and investigate further, maybe we can open an issue in the Github repository.

Hope it helps.

1 Like

Thanks for this work. How do I send the sample data to you?

Here, just as I did. Just extract any private details and try to make the data as simple as possible so we can pass that on a github issue on our public repository if a bug is identified. Otherwise is hard for developers to fix something they can't reproduce.

This is a community forum, and we don't attend private conversations. That's for our support team :slightly_smiling_face:

1 Like


Hi . I have attached sample data for your reference. Please guide me on this

You have attached an image. Please, if you could provide data in the way I did before, we may be able to give you a hand.

# Create index
PUT discuss-342090
{
  "settings": {
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "itemReceivedDate": {"type": "date", "format": "dd-MMM-yy"},
      "itemName": {"type": "text"},
      "itemLotId": {"type": "keyword"},
      "itemLocationAddress": {"type": "text"},
      "itemLocation": {"type": "text"},
      "itemInitialQuantity": {"type": "integer"},
      "itemRemQuantity": {"type": "integer"},
      "itemExpiryDate": {"type": "date", "format": "d-MMM-yy"}
    }
  }
}

POST discuss-342090/_bulk
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2608, Road 855 Block 608", "itemLocation": "ABCD", "itemInitialQuantity": 1, "itemRemQuantity": 1, "itemExpiryDate": "7-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2608, Road 855 Block 609", "itemLocation": "ABCD", "itemInitialQuantity": 1, "itemRemQuantity": 1, "itemExpiryDate": "7-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2608, Road 855 Block 610", "itemLocation": "ABCD", "itemInitialQuantity": 1, "itemRemQuantity": 1, "itemExpiryDate": "7-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2608, Road 855 Block 623", "itemLocation": "ABCD", "itemInitialQuantity": 1, "itemRemQuantity": 1, "itemExpiryDate": "19-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2608, Road 855 Block 624", "itemLocation": "ABCD", "itemInitialQuantity": 1, "itemRemQuantity": 1, "itemExpiryDate": "19-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2618, Road 865 Block 634", "itemLocation": "OPQR", "itemInitialQuantity": 11, "itemRemQuantity": 11, "itemExpiryDate": "29-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Tylenol (5-12 Years)", "itemLotId": "2345", "itemLocationAddress": "Bldg 2619, Road 866 Block 635", "itemLocation": "STUV", "itemInitialQuantity": 12, "itemRemQuantity": 12, "itemExpiryDate": "30-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Advil (5-12 Years)", "itemLotId": "7890", "itemLocationAddress": "Bldg 2620, Road 867 Block 636", "itemLocation": "WXYZ", "itemInitialQuantity": 13, "itemRemQuantity": 13, "itemExpiryDate": "31-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Benadryl (5-12 Years)", "itemLotId": "4567", "itemLocationAddress": "Bldg 2621, Road 868 Block 637", "itemLocation": "ABCDE", "itemInitialQuantity": 14, "itemRemQuantity": 14, "itemExpiryDate": "1-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Zyrtec (5-12 Years)", "itemLotId": "1235", "itemLocationAddress": "Bldg 2622, Road 869 Block 638", "itemLocation": "FGHIJ", "itemInitialQuantity": 15, "itemRemQuantity": 15, "itemExpiryDate": "2-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Claritin (5-12 Years)", "itemLotId": "6789", "itemLocationAddress": "Bldg 2623, Road 870 Block 639", "itemLocation": "KLMNO", "itemInitialQuantity": 16, "itemRemQuantity": 16, "itemExpiryDate": "3-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Motrin (5-12 Years)", "itemLotId": "3456", "itemLocationAddress": "Bldg 2624, Road 871 Block 640", "itemLocation": "PQRSTU", "itemInitialQuantity": 17, "itemRemQuantity": 17, "itemExpiryDate": "4-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Robitussin (5-12 Years)", "itemLotId": "8901", "itemLocationAddress": "Bldg 2625, Road 872 Block 641", "itemLocation": "VWXYZA", "itemInitialQuantity": 18, "itemRemQuantity": 18, "itemExpiryDate": "5-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Sudafed (5-12 Years)", "itemLotId": "5678", "itemLocationAddress": "Bldg 2626, Road 873 Block 642", "itemLocation": "BCDEFG", "itemInitialQuantity": 19, "itemRemQuantity": 19, "itemExpiryDate": "6-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2627, Road 874 Block 643", "itemLocation": "HIJKLMNOP", "itemInitialQuantity": 20, "itemRemQuantity": 20, "itemExpiryDate": "7-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Tylenol (5-12 Years)", "itemLotId": "2345", "itemLocationAddress": "Bldg 2628, Road 875 Block 644", "itemLocation": "QRSTUVWXYZA", "itemInitialQuantity": 21, "itemRemQuantity": 21, "itemExpiryDate": "8-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Advil (5-12 Years)", "itemLotId": "7890", "itemLocationAddress": "Bldg 2629, Road 876 Block 645", "itemLocation": "BCDEFGHI", "itemInitialQuantity": 22, "itemRemQuantity": 22, "itemExpiryDate": "9-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Benadryl (5-12 Years)", "itemLotId": "4567", "itemLocationAddress": "Bldg 2630, Road 877 Block 646", "itemLocation": "JKLMNOPQR", "itemInitialQuantity": 23, "itemRemQuantity": 23, "itemExpiryDate": "10-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Zyrtec (5-12 Years)", "itemLotId": "1235", "itemLocationAddress": "Bldg 2631, Road 878 Block 647", "itemLocation": "STUVWXYZ", "itemInitialQuantity": 24, "itemRemQuantity": 24, "itemExpiryDate": "11-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Claritin (5-12 Years)", "itemLotId": "6789", "itemLocationAddress": "Bldg 2632, Road 879 Block 648", "itemLocation": "ABCDEFGHIJKLMNOP", "itemInitialQuantity": 25, "itemRemQuantity": 25, "itemExpiryDate": "12-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Motrin (5-12 Years)", "itemLotId": "3456", "itemLocationAddress": "Bldg 2633, Road 880 Block 649", "itemLocation": "QRSTUVWXYZAB", "itemInitialQuantity": 26, "itemRemQuantity": 26, "itemExpiryDate": "13-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Robitussin (5-12 Years)", "itemLotId": "8901", "itemLocationAddress": "Bldg 2634, Road 881 Block 650", "itemLocation": "CDEFGHIJK", "itemInitialQuantity": 27, "itemRemQuantity": 27, "itemExpiryDate": "14-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Sudafed (5-12 Years)", "itemLotId": "5678", "itemLocationAddress": "Bldg 2635, Road 882 Block 651", "itemLocation": "KLMNOPQRST", "itemInitialQuantity": 28, "itemRemQuantity": 28, "itemExpiryDate": "15-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "1234", "itemLocationAddress": "Bldg 2636, Road 883 Block 652", "itemLocation": "UVWXYZABCDE", "itemInitialQuantity": 29, "itemRemQuantity": 29, "itemExpiryDate": "16-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Tylenol (5-12 Years)", "itemLotId": "2345", "itemLocationAddress": "Bldg 2637, Road 884 Block 653", "itemLocation": "FGHIJKLMNOPQR", "itemInitialQuantity": 30, "itemRemQuantity": 30, "itemExpiryDate": "17-Nov-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Panadol (5-12 Years)", "itemLotId": "5678", "itemLocationAddress": "Bldg 2609, Road 856 Block 625", "itemLocation": "EFGH", "itemInitialQuantity": 2, "itemRemQuantity": 2, "itemExpiryDate": "20-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Tylenol (5-12 Years)", "itemLotId": "2345", "itemLocationAddress": "Bldg 2610, Road 857 Block 626", "itemLocation": "IJKL", "itemInitialQuantity": 3, "itemRemQuantity": 3, "itemExpiryDate": "21-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Advil (5-12 Years)", "itemLotId": "7890", "itemLocationAddress": "Bldg 2611, Road 858 Block 627", "itemLocation": "MNOP", "itemInitialQuantity": 4, "itemRemQuantity": 4, "itemExpiryDate": "22-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Benadryl (5-12 Years)", "itemLotId": "4567", "itemLocationAddress": "Bldg 2612, Road 859 Block 628", "itemLocation": "QRST", "itemInitialQuantity": 5, "itemRemQuantity": 5, "itemExpiryDate": "23-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Zyrtec (5-12 Years)", "itemLotId": "1235", "itemLocationAddress": "Bldg 2613, Road 860 Block 629", "itemLocation": "UVWX", "itemInitialQuantity": 6, "itemRemQuantity": 6, "itemExpiryDate": "24-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Claritin (5-12 Years)", "itemLotId": "6789", "itemLocationAddress": "Bldg 2614, Road 861 Block 630", "itemLocation": "YZAB", "itemInitialQuantity": 7, "itemRemQuantity": 7, "itemExpiryDate": "25-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Motrin (5-12 Years)", "itemLotId": "3456", "itemLocationAddress": "Bldg 2615, Road 862 Block 631", "itemLocation": "CDEF", "itemInitialQuantity": 8, "itemRemQuantity": 8, "itemExpiryDate": "26-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Robitussin (5-12 Years)", "itemLotId": "8901", "itemLocationAddress": "Bldg 2616, Road 863 Block 632", "itemLocation": "GHIJ", "itemInitialQuantity": 9, "itemRemQuantity": 9, "itemExpiryDate": "27-Oct-23" }
{ "index": {} }
{ "itemReceivedDate": "28-Feb-23", "itemName": "Children's Sudafed (5-12 Years)", "itemLotId": "5678", "itemLocationAddress": "Bldg 2617, Road 864 Block 633", "itemLocation": "KLMN", "itemInitialQuantity": 10, "itemRemQuantity": 10, "itemExpiryDate": "28-Oct-23" }

# Create a Kibana Data View
POST kbn:/api/data_views/data_view
{
  "data_view": {
    "title": "discuss-342090",
    "timeFieldName": "itemExpiryDate"
  }
}

Hi @jsanz . Request you to share if there is any update on this.

Tried to replicate and this works on my environment.

On a 8.7.1 stack, after uploading the data, I created a dashboard with

  • A table splitting per expiry date (14 days) with the sum of ItemRemQuantity as a metric.
  • Then three metrics summing the same field. One without a custom time filter and the other two looking into the last 3 months and the next 3 months.

The metrics seem to work correctly. The one on the left and the center give zero results, and the one on the right looks into the next three months, giving the correct 469.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.