I have to create a visualization that MUST only show the data/graphic if a condition is met.
More context to this question:
In Elasticsearch we have docs containing the stock information of different bicycles.
The bicycles are owned by different dealers.
Each dealer can set their own price for each bicycle.
I want a visualization that shows the average price of a bicycle model within the stock, BUT this information can only be shown if at least 5 dealers have the same bicycle model in stock.
Is this possible?
If yes, could you please give me a hint.
Thank you in advance.
Welcome to the community! I'm not aware of a way to hide the visualization based on a condition, but you should be able to use a condition in the visualization to filter the data:
It will show a no results found message if no documents match the condition:
Hope that helps!
While this is not strictly a filter, you could use a Lens Formula to achieve something similar.
Here I created an example of
AvgTicketPrice for GB only if there are 3 Carriers than have flights that lands in that country:
ifelse(unique_count(Carrier, kql='DestCountry: GB') > 3, average(AvgTicketPrice), 0)
In case the criteria is not met then
0 (or any value you put in there) will be shown.
Note that this is just a visualization trick and it is still possible to inspect the raw response from Elasticsearch which contains the
average(AvgTicketPrice) value (the condition is evaluated only on the client, the server is not aware of it).
Thank you Carly and Marco for your answers.
Marco, your suggestion is very helpful. Since the EU has rigorous privacy/data policies, I still need to hide that information in the raw response.
My approach will be to use this Lens formula and embed the dashboard in a website that filters the raw data in these responses.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.