How to display data in Metric element?

This is my first time use canvas , I think my question is simple.

I wana to display a result in Metric element , the result can preview in data sheet just like the picture below


But the same result can't display in the Metric element, as the picture show:

below is the Expression editor code :
filters
| essql query="SELECT SUM(UnBlendedCost) as TotalCost FROM "billing*""
| math "TotalCost"
| metric "Total Cost"
metricFont={font family="'Open Sans', Helvetica, Arial, sans-serif" size=48 align="center" color="#000000" weight="normal" underline=false italic=false}
labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center"}
| render
containerStyle={containerStyle backgroundColor="rgba(255,255,255,0)" border="3px none " borderRadius="1px"}

I don't know what the problem is, If anyone can help me, Thank you

1 Like

Hi @shawn_sun,

your code looks fine to me (besides unescaped double quotes in the sql query, but that was probably caused by copy/pasting it here). Do you have a filters component on the same page that could interfere with data fetching?

If not could you paste the result of the following expression? This will show the value passed down from the query

filters
| essql query="SELECT SUM(UnBlendedCost) as TotalCost FROM \"billing*\""
| math "TotalCost"
| metric "Total Cost"
metricFont={font family="'Open Sans', Helvetica, Arial, sans-serif" size=48 align="center" color="#000000" weight="normal" underline=false italic=false}
labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center"}
| render as=debug

Just to make sure the data fetching works correctly please also paste the result of this expression

filters
| essql query="SELECT SUM(UnBlendedCost) as TotalCost FROM \"billing*\""
| render as=debug

Hi, @flash1293
Yeah , I have a time filter component on my workpad. When I remove the time filter, the result can display. Thanks very much.
Here is new exception , When I add the time filter, other elemet on the workpad will except a exception message like the picture below:


I think it's my mapping doesn't match the canvas dataformat . I can't modify the @timestamp's format. Is there any other way to fix this exception ?

There is currently no way to fix this - that's definitely a bug. Would you mind reporting this problem by creating an issue in the Github repository?

It's no problem, I will submit this issue in Github and I hope it can fixed as soon as possible. Thanks very much.

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