Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the following issue. I need to show how many days campaigns are live by 'Advertiser'. I can calculate days live by 'Campaign', including 'Advertiser' and 'Campaign' in a pivot table, but when I don't show 'Campaign' field, days live appears as a sum, and not like an average.
E.g: Advertiser Abril, has 2 campaigns (1 Cyrela - 2 Porto Seguro). Cyrela was live 31 days, and Porto Seguro was live 3 days. In a pivot table, I include:
'Advertirser' -> 'Campaign' -> 'DaysCampaigns' and information is shown properly. But when I exclude 'Campaign' fields from the pivot table, Abril appears with 34 days live (31+3), and I need to show information as 17 days live (31+3)/2.
I would appreciate someone's help. Attached file
Thanks
Guido
Hi Guido,
try following expression:
=sum(DaysCampaigns)/count(distinct Campaign)
this should give you the average duration of a campaign.
It's kind of logical that the values appeared as a sum and not as average before, since the expression was a sum of DaysCampaign, isn't it? And if you remove the Campaign field, QlikView will aggregate /sum up to the Advertiser dimension level, so you will get 34 in your example. If you want something different from a sum, we need to tell QV what we want, and there are a lot of different functions available. Please have a look at the chart aggregation functions in the Help.
Regards,
Stefan
Hi Guido,
try following expression:
=sum(DaysCampaigns)/count(distinct Campaign)
this should give you the average duration of a campaign.
It's kind of logical that the values appeared as a sum and not as average before, since the expression was a sum of DaysCampaign, isn't it? And if you remove the Campaign field, QlikView will aggregate /sum up to the Advertiser dimension level, so you will get 34 in your example. If you want something different from a sum, we need to tell QV what we want, and there are a lot of different functions available. Please have a look at the chart aggregation functions in the Help.
Regards,
Stefan
Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am
23.09.2011.
Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.
Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!
according to the data from your uploaded file, all days are 1 in the field DaysCampaign, so, the average will be 1, but try the following if your data is different.
avg(DaysCampaign)
pho3nix90,
I believe we are looking at some very granular data, maybe some kind of transaction data. If you do a
avg(DaysCampaign) on that level, you would get numbers <=1 (not always 1, there are some zero DaysCampaign values also).
But as gdigiorno stated, he expects the average on a campaign level, so you have to sum up the granular data.
If you want to use the avg() function, you could use:
=avg(aggr(sum(DaysCampaigns), Campaign))
for that, but that's more complicated IMHO, especially for a starter with QV.
Regards,
Stefan
Hi,
I tried the following formulas:
=sum(DaysCampaigns)/count(distinct Campaign)
=avg(aggr(sum(DaysCampaigns), Campaign))
Both are OK. If I exclude "campaign" field, these formulas returns
'Advertiser's average.
Thanks for your help!
Regards,
Guido
2011/9/5 swuehl <qliktech@sgaur.hosted.jivesoftware.com>
**
QlikCommunity <http://community.qlik.com/index.jspa>
Re: How can I calculate average fields without showing a field?
created by swuehl <http://community.qlik.com/people/swuehl> in *New to
QlikView* - View the full discussion<http://community.qlik.com/message/146520#146520>
Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am
23.09.2011.
Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.
Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!
Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am
23.09.2011.
Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.
Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!
Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am
23.09.2011.
Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.
Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!