Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate average time for aggregated attributes in Pie Chart

Hello all,

I need to build a pie chart that shows the average time (in days and months) between a Start and  End Date for an aggregated set of status.

I’m trying to define the aggregation of Status values in the load script.

The attached file is a sample of what I’m trying to do and shows a pie chart that gives results, but without aggregation on Status attribute.

Could anyone help on this, please?

Many thanks

Paulo

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

See the attached qvw.

Regards,

Fernando V.

View solution in original post

12 Replies
sunny_talwar

What is the expected output? Can you provide some information on the expected output here?

Not applicable
Author

Hi Sunny,

Bases on the Qvw provided, my expected output is to have a pie chart with several attributes aggregated by status as follows:


Average time (in days and months) between a Start and  End Date, If Status = '1', '2'

Average time (in days and months) between a Start and  End Date, If Status = '25', '28'

Average time (in days and months) between a Start and  End Date, If Status = '4'

Average time (in days and months) between a Start and  End Date, If Status = '5'

Average time (in days and months) between a Start and  End Date, If Status = '24'

Please let me know if you need further information

Thanks

Paulo

sunny_talwar

I am still not sure how you are getting these numbers? I am assuming that for Status =1, you would want the Avg(DayDiff) = 2 when we are on days? how are you getting 2 here? What is the logic? Also, you provided the output for Status = 1 and Status = 2 (I assume 25 was a typo and you meant 2 here), but what about the rest 4, 5, 24? and also what about others 3, 6?

Anil_Babu_Samineni

Perhaps This


Avg ({<Days={'>=' & Weekday(Date(StartDate)) '<=' & Weekday(Date(EndDate))}, Months={'>=' & Weekday(Date(StartDate)) '<=' & Weekday(Date(EndDate))}, Status = {'1','2','25','28','4','5','24'>} Timestamp(time,'hh:mm:ss'))

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Not applicable
Author

Ok. I will try to clarify.

Please look to the Qv application and sample excel file I send in attach to check the numbers and an idea of the expected result. To know if we are on Days or Months I’m thinking to consider ‘Days’ and ‘Months’ as a Cycle field that the user could choose to switch between Days and Months, then the graph should adjust the results according the selection.

Diff Days was an attribute created in a tentative to solve this. You could ignore if not required for your approach. 25 was a typo and the other status could be ignored. I only want to consider the values for Status as described inside the Qv application (Text Object)

I have a Start and End Date with a field Status related. Grouping the status according the logic described inside the Qv application (Text Object), I need to know the time spent when the status match the conditions.

Thanks

Paulo

Not applicable
Author

Hi Anil,

Is not working. The expression is given error.

Thanks

Paulo

Not applicable
Author

Hi Sunny,

Is there other input or information you need?

If so please let me know. I'm struggling to get this working but with no luck so far...

Thanks

Regards

Paulo

Not applicable
Author

Hi Sunny,

Any clue to help?

Thanks

Paulo

Anonymous
Not applicable
Author

Paulo,

See if this is what you are looking for.

Fernando V.