How to switch rows and columns in datatable in Canvas?


I would like to get help with kibana Canvas.

I have a data table as below.

My goal here is to create a table like below. I want to create columns according to the value of tag_type.

shape.model    first     second     pending
null              0           0       8851
ahead_txt         1          25          0
billboard        25         368          0

My current query is below.

| essql 
  query="SELECT shape.model, tag_type, COUNT(tag_type) FROM \"tags\" WHERE tag_type IS NOT NULL GROUP BY shape.model, tag_type"
| table perPage=25
| render

I am thinking of mapColumn might do the work but I cannot figure out the right syntax from the document.

I have also checked below blog but could not find related issue.

If I can do something like below but cannot figure out how.:

mapColumn "Status1" fn={if {getCell "tag_type" | eq "first"} then=GET COLUMN COUNT_tag_type_ else=0}

Could some one help me out to achieve my goal ?


I figured it out . There was a good example on this page


Glad you figured it out and that we had a doc that was helpful!

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