Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to count how many times there is an article whose "view" for a given month's statistics for "2019-09-01" and for a given month of publication "2019-09-01" meets the condition of the average number of "views" for an article for the period up to "2019-09-01"
The average for one article is = 653.8333333
The result should be 1
Variable "avg_view "
=sum({<datastart={"$(= '<=' &date(Monthend(Now(),-1),'YYYY-MM-DD') )"}>} view)
/
count(distinct {<publishedAt={"$(= '<=' &date(Monthend(Now(),-1),'YYYY-MM-DD') )"} >} title)
I know I should use count (AGGR ()) but I can not help it, can you help?
Can you provide a sample app?
Sample app attached
In your test table, add a new expression like this:
sum({<view={">=$(avg_view)"}>}view)
If I want to show data for a given period 01-09-2019, not in the table only as a text field
Do you mean like this?
Expression in the textbox:
=count(aggr(sum({<view={">=$(avg_view)"}>}view),title))
More or less
In this case, it is about showing the meter for the sum of the given month in this case 09-2019.
I tried to modify what you showed but something is not working yet
=count(
aggr(
sum(
{<view={"<=$(avg_view)"},
[Month stat]={"$(= '>=' & Date(Monthstart(Now()),'YYYY-MM-DD') & '<=' &
Date(monthend(Now()),'YYYY-MM-DD'))"}>}
view)
,title))
I tried it this way
=count(
aggr(
if(
sum(
{<
[Month stat]={"$(= '>=' & Date(Monthstart(Now()),'YYYY-MM-DD') & '<=' &
Date(monthend(Now()),'YYYY-MM-DD'))"}>}
view )>=avg_view
,1,0)
,title)
I am still wondering how to show which article did not meet the total for the last 3 months.
I also don't want to work
=count(
aggr(
sum(
{<
view={"<=$(avg_view)"},
[Month stat]={"$(= '>=' & Date(Monthstart(Now(),-3),'YYYY-MM-DD') & '<=' &
Date(monthend(Now()),'YYYY-MM-DD'))"}
>}
view)
,title))
So, based on the data provided... what is the count you are expecting to see for 09-2019? and count for last 3 months?
Mariusz, did you get things sorted? If so, please consider leaving your solution in a new post on this thread, once posted, you can use the Accept as Solution button to mark it as well to let everyone know that is what worked. If you can reply to Sunny's comment if you are still working upon things, he or someone else may be able to provide further help on things.
Regards,
Brett