Hi Guys,
I am trying to create a Canvas page for Data Findings for the current month which compares Data records from the Previous Month and outputs the Result as "Increase" if the number of counts are greater then the Previous month, and Reults as "Decrease" if number of counts are Less compared to the Previous month.
For this I have a SQL Query in place:
SELECT "calcltd.monthNumber",count(*) As CurrentMonth,
"calcltd.monthName",Count(*) As PreviousMonth,
Case
When
Count("calcltd.monthNumber") > Count("calcltd.monthName")
Then
CAST ('Increase' As String)
When
Count("calcltd.monthNumber") < Count("calcltd.monthName")
Then
'Decrease'
Else 'Equal'
End
As Measure
FROM "events-appdb-*"
group by "calcltd.monthName","calcltd.monthNumber"
The Issue here is i am currently using a Global Time Filter group for all the canvas pages- "Time"(Selected for 1 month complete) and using the field "calcltd.monthNumber" ( which gives me the result for the current month)
In order to refer to the Previous month im using a Dropdown Select Filter "calcltd.monthName" which is Grouped under a different Filtergroup-"Month"
Is there any way that i can recall the filter group values in the expression for the Fields "calcltd.monthNumber" and "calcltd.monthName",from thier respective Filter groups.
Currently this the Expression Editter.
filters "Time" "Month-01" ungrouped=true
| essql
query="SELECT "calcltd.monthNumber",count(*) As CurrentMonth,
"calcltd.monthName",Count(*) As PreviousMonth,
Case
When
Count("calcltd.monthNumber") > Count("calcltd.monthName")
Then
CAST ('Increase' As String)
When
Count("calcltd.monthNumber") < Count("calcltd.monthName")
Then
'Decrease'
Else 'Almost Same'
End
As Measure
FROM "events-appdb-*"
group by "calcltd.monthName","calcltd.monthNumber"
"
| math "Measure"
| metric ""
metricFont={font align="center" color="#BBBBBB" family="'Open Sans', Helvetica, Arial, sans-serif" italic=false size=32 underline=false weight="bold"}
labelFont={font align="center" color="#000000" family="'Open Sans', Helvetica, Arial, sans-serif" italic=false size=14 underline=false weight="bold"}
| render
Ex; can i do something like this ??????
| essql
query="SELECT "calcltd.monthNumber",count(*) As CurrentMonth From Filter Group="Time",
"calcltd.monthName",Count(*) As PreviousMonth from Filter Group="Month",
Case
When
Count("calcltd.monthNumber") > Count("calcltd.monthName")
Then
CAST ('Increase' As String)
When
Count("calcltd.monthNumber") < Count("calcltd.monthName")
Then
'Decrease'
Else 'Almost Same'
End
As Measure
FROM "events-appdb-*"
group by "calcltd.monthName","calcltd.monthNumber"
"
| math "Measure"