Hi !
I'm trying to create a Data Table in canvas.
I would like to add 3 columns in my table:
- Asset
- Volumes (as a count of record)
- % On Total (as Asset Volumes/Total Volumes)
I create the follow script in espression editor, but my espression failed with the message "[essql] > Can not cast 'datatable' to any of string,number, boolean".
How can I change my espression ? There is a way to populate a variable or a parameter with dynamic value? (In my case with the count of total row ? )
filters
| var_set name="Total" value={
essql query="SELECT count(*) FROM \"index-pattern*\" where Date > dateadd('MM',-1,curdate()) and ReportDate < dateadd('DD',-2,curdate()) "
}
| essql
query="select Asset,
count(*) as Volumi,
count(*)/? *100 as PercOnTotal
from \"index-pattern*\"
where
Date > dateadd('MM',-1,curdate()) and Date < dateadd('DD',-2,curdate())
group by Asset" parameter={var "Total"}
| table
| render
Thanks,
Chiara