If condition in Kibana Table Visualization

Hi, is it possible to use if condition in a Kibana Table Visualization?

I want to build a financial table that counts a line item and then multiply the quantity with a specific value for each volume level.

Hi @micaelle Welcome to the community

What version are you on?

Have you tried the Lens Table with Formulas? Perhaps that will be a good fit.

Here is a nice Blog with some examples

1 Like

I had checked out this blog before but it didn't really help. I'm using Kibana version 8.1.3. what I need is to create a condition that depends on 3 of the 10 existing fields of an index, so if the count of these fields is greater than 100, I will need to do the multiplication by 2, if it is greater than 1000 by 3, and so on.

I think with that kind of logic you may need to create a new field on ingest with and ingest pipeline or a runtime field (Which has full conditional logic)

I don't think formulas in Lens do conditional logic yet... but there are mod functions etc... so perhaps you could...

if you provided samples of the data ... the formula and expected results perhaps someone could help...

I have the data about the transactions made by the users and also about the accounts that made those transactions. I need to count how many accounts there are and how many pix there were and if the amount of accounts is less than 100 and the amount of pix is less than 500, the total cost will be 2,000.00, if the amount of accounts is less than 200 and the amount of pix less than 1000, the total cost will be 4,000.00.

The formula I'm still building because I'm a beginner in elastic, but the condition would be like count(operations.keyword pix.sent) + count(operations.keyword pix.received) <500 and unique_count(account_id.keyword) <100 then

image

Hi @micaelle,

while there's no current conditional helpers yet available in Lens, it is possible to achieve something like you want using some math. I've written some explanation in here on how to leverage the clamp function for this use case: Dec 4th, 2021: [en] Advanced trick and tips in Lens

In your example, you probably have to add one more layer of complexity there as you depends on two distinct conditions:

(
clamp( count(operations.keyword pix.sent) + count(operations.keyword pix.received) - 500, 0, 1) + 
clamp( unique_count(account_id.keyword) - 100, 0, 1)
) * 2000
1 Like

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