Skip to main content

Need help woth pql code.

For example, in a particular 1 hour the count of activity is 89 or 56 or 05, then that count has to be considered as 1

How can I achieve this? ​

Something like this?:

 

CASE WHEN

(SUM(

CASE WHEN HOUR(ACTIVITYTABLE.TIMESTAMP) = <hour you want> THEN 1 ELSE 0 END

)

) > 0 THEN 1

ELSE 0

END


Something like this?:

 

CASE WHEN

(SUM(

CASE WHEN HOUR(ACTIVITYTABLE.TIMESTAMP) = <hour you want> THEN 1 ELSE 0 END

)

) > 0 THEN 1

ELSE 0

END

Sure, I will try this.

Basically I want the sum for every hour in a week.

Can you please guide me how to consider this


Sure, I will try this.

Basically I want the sum for every hour in a week.

Can you please guide me how to consider this

In that case, use as DIMENSION

 

WEEKDAY(activity table.timestamp)

 

and

 

HOUR(activitiytable.timestamp)

 

and as KPI

 

COUNT(Activitytable)

 

That will give you in a OLAP for each day of the week, for each hour of that day, the total number of activities.

 

If you want to restrict to a week, you can either add WEEK(activity table.timestamp) as the first DIMENSION, of filter the result to the week you want (either as a component filter or with a data picker or....)

 

In same cases you can't have several dimensions, in those situations concatenate the dimension and use them as the single dimension. I.e. DIMENSION = WEEKDAY(timestamp)||'-'||HOUR(timestamp)

 

HTH


Reply