Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Semiro
Contributor
Contributor

Avg of a count for a quarter

Hi!

I need some help to calculate avg of every quarter for 2019 and 2020. See picture below. The first graph is what I have now, but I need to be more like second graph - with avg value of every quarter. So mDate should be like avg of Q1 2009, Q2 2009 ... Q1 2020, Q2 2020 and so on.

graphs.gif

The graph should lool like this but with only one expression and contain 2019 and 2020 (like graph above). 

Semiro_0-1603262703016.png

 

In the script I have added ceil(month(Date)/3) as Quarter, so I can get the quarters, but here it ends... how do I move on to fix it? I think It should be something with a avg(aggr... but im not sure.

My script looks like this:

script.gif

Thans in advance!

Please feel free to move this topic to another location if this is wrong location.

Best regards,
Semiro

8 Replies
Anil_Babu_Samineni

For me, It is purely settings, Can you dropdown and choose Circle and see? To custom the circle you can play around in Presentation tab.

C1.png

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Semiro
Contributor
Contributor
Author

Hi Anil and thanks for a quick reply. 

I know about that setting, but Its not the solutions In this case. What I want is a line graph (like the first graph) with a avg of every quarter and not like I have now. January 2019, Feb 2019 ... January 2020, Feb 2020... I want it more like Q1 2009, Q2 2009 ... Q1 2020, Q2 2020 where Q1 2019 is avg of Jan, Feb and Mar 2019 and so on. 

Anil_Babu_Samineni

I can help you out that also, Will you able to offer QVW or QVF with some source? You need to dig into some script with Concat using Dual table and Fact table..

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

@Semiro I think you might need to use Quarter as your dimension and may be this as your expression

Count(Category)/3

 

Semiro
Contributor
Contributor
Author

Hi Sunny,
Thanks for the tip! I will try that.

Semiro
Contributor
Contributor
Author

Hi Sunny,
Im really close now to getting what I want, but there is still some problems.

I have also used one of you other scripts:
Year(Date#(mDate, 'MMMM YY')) & 'Q' & Ceil(Month(Date#(mDate, 'MMMM YY'))/3) as Quarter,

instead of 

Ceil(month(Date)/3) as Quarter, 

As you can see below, Im really cloes to my goal:

Semiro_0-1604325255880.png

But I dont know why Im gettign just "Q" alone. 
Some other people hade same problem and It was because some of the dates was null. Its not the problem in my case.

And one other thing:

Semiro_1-1604325428805.png

 

When I mark 2019Q2, I only getting April and May.. why not June 2019?

But when Im using just Ceil(month(Date)/3) as Quarter, I getting correct dates:

Semiro_3-1604327497408.png

Thanks in advance!

Best regards,
Semiro

Brett_Bleess
Former Employee
Former Employee

I would have to believe there is something wrong in your data model regarding the link between the Quarter field and the actual values in there.  I do see a Q value in the Quarter list box, that would seem to be incorrect by some form as well, so data model is where I would be looking at this point, you will need to attach qvw file if you want further help I believe, as folks are going to need to be able to dig into the data model and object and expressions at this point to try to figure out what is wrong.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Semiro
Contributor
Contributor
Author

Hi Brett,

Quite new at Qlik but here is the qvw-file. Hope the file works fine.

BR,
Semiro