Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm having difficulties getting the result I want in a pie chart.
I have attached a document that illustrates my problem.
Basically I want to have 2 pie charts.
The first one should show how many users there are per CAL type (NamedUser and Doc in the attached file).
This is already working.
The second pie chart is the problem (named "Number of CALs per CAL Type" in the attached file).
I want it to show how many CALs of each cal type that is needed.
In this example it should show 1 NamedUserCAL and 6 Doc CALs
But everything I have tested has failed.
Does anyone know how to do this?
Br
Martin
Hi Martin,
(sounds german)
try the code below as expression in your second chart:
if(aggr(textcount(DISTINCT Document), User)>3, Count( DISTINCT User), count(User))
HtH
Roland
Hello Roland,
Thank you for your reply.
It looked promising but unfortunately your suggestions did not solve my problem.
I have updated the attached file to illustrate why.
If the same user opens the same document more than one time, they are counted each time.
I only want distinct documents per user when the user has opened less than 4 documents and distinct users for those users that have opended 4 or more documents.
Any other suggestions?
And by the way, I'm not german, I'm swedish.
br
Martin
HI
From my understanding, i think you want like this''
= if user open the document less than 4 means want to count the document ,otherwise want to count the user?? am i correct??
if(aggr(textcount(DISTINCT Document), User)<4, Count( Document), count(distinct User))
or
if(aggr(textcount(DISTINCT Document), User)>3, aggr(textcount(DISTINCT Document), User), count(distinct User))
helps you..
sorry, i didn't open the file..
See attached qvw. Is that what you need?
Hello Martin,
"I only want distinct documents per user when the user has opened less than 4 documents and distinct users for those users that have opended 4 or more documents."
Ok, got it.
So I applied a new dimension called "DocType" (see Script). This dim may be useful in several charts. I used it in my expression within the IF()-Clause as a switch and also in the other pie chart as a "normal" dim. And the two different countings (in one expression!) should work as expected.
"And by the way, I'm not german, I'm swedish."
Sorry, I thought that I may have met an old fellow martin I didn't see for some years.
HtH
Roland
Hello Roland,
Your solution both works and dont work.
It gives the correct values but since your have created a static version of CALType per user it will not work when other selections are made, e.g. dates.
But perhaps it is better to remove the possibility to select dates and calculate this in the script.
Thank you for your reply.
br
Martin
Hello Gysbert,
Thank you for your reply.
Your solution gives the right result but it also shows a second figure in the pie chart.
Is there any way to remove the extra figure?
br
Martin
Hello,
I have attached an image that shows the extra image.
br
Martin
Fun. It looks fine in QV 10, but in QV 11 you get the extra number in a pie chart with no dimension and two expressions. Ok, here's a version that looks ok in QV 11 too with one dimension and one expression.