How can I create a pie chart using only the value of a cell, based on certain criteria? - pie-chart

I am trying to make a pie chart that consists of the actual value (%) in a given cell, which will be selected by some filters.
I have a data set that consists of an employee per row, with several metrics in each column.
Filters:
First filter on employee: person_1
Second filter on wk_no: 01
and I would like to return that value for metric x_5 >> so I want to have a pie-chart that is divided in a 65%-slice and also in a 35%-slice...
I have added an extra column: x_8 = 100%-x_5; but still haven't figured it out...
Data table:
employee
emp_no
wk_no
x_1
x_2
x_3
x_4
x_5
x_6
x_7
person_1
51926
01
152
4%
90
35
65%
8%
56%
person_2
53260
01
143
17%
22
86
39%
46%
39%
person_3
55138
01
244
30%
204
236
64%
46%
71%
person_4
56884
01
446
23%
142
301
61%
24%
41%
person_5
52484
01
150
16%
31
77
55%
70%
94%
Files:
datastudio report
dataset sheet

You can make a Lighthouse Gauge chart, see Community visualizations.

Related

Creating a parameter filter to pick out consecutive data (Tableau Desktop)

I have a data set as following:
week number
date
item
location
Out of stock %
23
2022-06-05
apple
Seattle
55%
23
2022-06-06
apple
Seattle
60%
23
2022-06-07
apple
Seattle
50%
23
2022-06-08
apple
Seattle
50%
23
2022-06-09
apple
Seattle
50%
23
2022-06-10
apple
Seattle
50%
23
2022-06-11
apple
Seattle
60%
23
2022-06-06
orange
California
10%
23
2022-06-07
orange
California
5%
23
2022-06-08
orange
California
5%
23
2022-06-09
orange
California
30%
23
2022-06-06
orange
California
20%
23
2022-06-07
orange
California
10%
23
2022-06-08
orange
California
2%
My desired output is to have an Out of stock filter for the viewers so that when they enter a certain value, it returns a list of a certain week in which the out of stock is no lesser than the certain value.
For example, if I enter 40% in the filter, then apple at Seattle would only show up.
This apple would be then marked as continuously out of stock. Please help me!

Group Mulitple Rows into 1 email in mail merge

I have to send an email out to all the team managers of my company providing the individual stats for each member of their team. Unfortunately I am not very well acquainted with mail merge and have been running into multiple knowledge gaps. I was hoping somebody here could help me understand how I can do this. If the sample data looks like this:
TM Email
Employee Name
Call Goal
Actual
% Goal Met
# of Audits
Accuracy
email1#fakeemail.com
John Doe
100
50
50%
4
92%
email1#fakeemail.com
Jane Doe
100
50
50%
4
92%
email1#fakeemail.com
Eric Stultz
100
50
50%
4
92%
email1#fakeemail.com
Christian Noname
100
50
50%
4
92%
email1#fakeemail.com
Fakename Mcgee
100
50
50%
4
92%
email1#fakeemail.com
senor chapo
100
50
50%
4
92%
email2#mail.com
Duck Werthington
100
50
50%
4
92%
email2#mail.com
Myster Eeman
100
50
50%
4
92%
email2#mail.com
Ion No
100
50
50%
4
92%
email2#mail.com
No Idea
100
50
50%
4
92%
email2#mail.com
Mail Man
100
50
50%
4
92%
Assume that there are over 2 dozen Team Managers with varying team sizes. and the email will be sent in the same format as listed above. How would I go about this, I don't even know where to begin. Please help.

Averaging using Group by and Distinct in sql

This is a bit convoluted but I will try to make it not so. Below is a snippet of the data and the intended result below it. For every combination of state, area, indcode, and ownership I want to calculate an average. My knowledge of AVG in SQL would average the entire column not just specific values.
state areatype area period indcode ownership sites employment
32 05 000001 01 102800 12 25 256
32 05 000001 01 102900 13 6 26
32 05 000003 01 102800 12 774 1874
.
.
32 05 000001 02 102800 12 27 239
32 05 000001 03 102800 12 28 241
32 05 000001 04 102800 12 29 248
Intended result
32 05 000001 00 102800 12 27 246
Would the following code do this or be even close?
Select avg(employment, sites)
From Select (Distinct(state, area, indcode, ownership) from dbo.tablename;
select
[state], areatype, area, '00' [period], indcode, ownership,
avg(sites) sites, avg(employment) employment
from dbo.tablename
group by [state], areatype, area, indcode, ownership;
Got this mostly by trial and error and help from another site. Not really sure why it works but its close enough.

User-written program winsor by Nick Cox: determining p

I would like to use the winsor command written by Nick Cox. According to this page http://www.stata.com/statalist/archive/2011-09/msg01340.html the author states that the usual percentile of winsorizing is 1/99 and 5/95.
Am I correct that p(0.1) corresponds to the 1/99 percentile winsorizing? or is it p(0.01)?
The latter seems more intuitive, however the value p(0.5) would yield the average (which make no sense in this case).
Thank you very much.
EDIT: I am sorry, I tried p(0.5) and it does not work. Therefore, I guess p(0.01) corresponds to 1/99 and p(0.05) to 5/95 percentile.
EDIT2: I am sorry for the misunderstanding. I have misinterepreted the authorĀ“s procedure of handling outliers (drawing boxplots in order to identify points beyond the
1/99 or 5/95 percentiles).
0.1 corresponds to winsorising at 10th and 90th percentile:
. sysuse auto
(1978 Automobile Data)
. sum price , detail
Price
-------------------------------------------------------------
Percentiles Smallest
1% 3291 3291
5% 3748 3299
10% 3895 3667 Obs 74
25% 4195 3748 Sum of Wgt. 74
50% 5006.5 Mean 6165.257
Largest Std. Dev. 2949.496
75% 6342 13466
90% 11385 13594 Variance 8699526
95% 13466 14500 Skewness 1.653434
99% 15906 15906 Kurtosis 4.819188
. winsor price , p(0.1) gen(wp)
. sum wp, detail
price, Winsorized fraction .1
-------------------------------------------------------------
Percentiles Smallest
1% 3895 3895
5% 3895 3895
10% 3895 3895 Obs 74
25% 4195 3895 Sum of Wgt. 74
50% 5006.5 Mean 5997.432
Largest Std. Dev. 2434.708
75% 6342 11385
90% 11385 11385 Variance 5927804
95% 11385 11385 Skewness 1.294202
99% 11385 11385 Kurtosis 3.29362

Units of perf stat statistics

I'm using perf stat for some purposes and to better understand the working of the tool , I wrote a program that copies a file's contents into another . I ran the program on a 750MB file and the stats are below
31691336329 L1-dcache-loads
44227451 L1-dcache-load-misses
15596746809 L1-dcache-stores
20575093 L1-dcache-store-misses
26542169 cache-references
13410669 cache-misses
36859313200 cycles
75952288765 instructions
26542163 cache-references
what is the units of each number . what I mean is . Is it bits/bytes/ or something else . Thanks in advance.
The unit is "single cache access" for loads, stores, references and misses. Loads correspond to count of load instructions, executed by processors; same for stores. Misses is the count, how much loads and stores were unable to get their data loaded from the cache of this level: L1 data cache for L1-dcache- events; Last Level Cache (usually L2 or L3 depending on your platform) for cache- events.
31 691 336 329 L1-dcache-loads
44 227 451 L1-dcache-load-misses
15 596 746 809 L1-dcache-stores
20 575 093 L1-dcache-store-misses
26 542 169 cache-references
13 410 669 cache-misses
Cycles is the total count of CPU ticks, for which CPU executed your program. If you have 3 GHz CPU, there will be around 3 000 000 000 cycles per second at most. If the machine was busy, there will be less cycles available for your program
36 859 313 200 cycles
This is total count of instructions, executed from your program:
75 952 288 765 instructions
(I will use G suffix as abbreviation for billion)
From the numbers we can conclude: 76G instructions executed in 37G cycles (around 2 instructions per cpu tick, rather high level of IPC). You gave no information of your CPU and its frequency, but assuming 3 GHz CPU, the running time was near 12 seconds.
In 76G instructions, you have 31G load instructions (42%), and 15G store instructions (21%); so only 37% of instructions were no memory instructions. I don't know, what was the size of memory references (was it byte load and stores, 2 byte or wide SSE movs), but 31G load instructions looks too high for 750 MB file (mean is 0.02 bytes; but shortest possible load and store is single byte). So I think that your program did several copies of the data; or the file was bigger. 750 MB in 12 seconds looks rather slow (60 MBytes/s), but this can be true, if the first file was read and second file was written to the disk, without caching by Linux kernel (do you have fsync() call in your program? Do you profile your CPU or your HDD?). With cached files and/or RAMdrive (tmpfs - the filesystem, stored in the RAM memory) this speed should be much higher.
Modern versions of perf does some simple calculations in perf stat and also may print units, like shown here: http://www.bnikolic.co.uk/blog/hpc-prof-events.html
perf stat -d md5sum *
578.920753 task-clock # 0.995 CPUs utilized
211 context-switches # 0.000 M/sec
4 CPU-migrations # 0.000 M/sec
212 page-faults # 0.000 M/sec
1,744,441,333 cycles # 3.013 GHz [20.22%]
1,064,408,505 stalled-cycles-frontend # 61.02% frontend cycles idle [30.68%]
104,014,063 stalled-cycles-backend # 5.96% backend cycles idle [41.00%]
2,401,954,846 instructions # 1.38 insns per cycle
# 0.44 stalled cycles per insn [51.18%]
14,519,547 branches # 25.080 M/sec [61.21%]
109,768 branch-misses # 0.76% of all branches [61.48%]
266,601,318 L1-dcache-loads # 460.514 M/sec [50.90%]
13,539,746 L1-dcache-load-misses # 5.08% of all L1-dcache hits [50.21%]
0 LLC-loads # 0.000 M/sec [39.19%]
(wrongevent?)0 LLC-load-misses # 0.00% of all LL-cache hits [ 9.63%]
0.581869522 seconds time elapsed
UPDATE Apr 18, 2014
please explain why cache-references are not correlating with L1-dcache numbers
Cache-references DOES correlate with L1-dcache numbers. cache-references is close to L1-dcache-store-misses or L1-dcache-load-misses. Why numbers are no equal? Because in your CPU (Core i5-2320) there are 3 levels of cache: L1, L2, L3; and LLC (last level cache) is L3. So, load or store instruction at first trys to get/save data in/from L1 cache (L1-dcache-loads, L1-dcache-stores). If address was not cached in L1, the request will go to L2 (L1-dcache-load-misses, L1-dcache-store-misses). In this run we have no exact data of how much request were served by L2 (the counters were not included into default set in perf stat). But we can assume that some loads/stores were served and some were not. Then not served-by-L2 requests will go to L3 (LLC), and we see that there were 26M references to L3 (cache-references) and half of them (13M) were L3 misses (cache-misses; served by main RAM memory). Another half were L3 hits.
44M+20M = 64M misses from L1 were passed to L2. 26M requests were passed from L2 to L3 - they are L2 misses. So 64M-26M = 38 millions requests were served by L2 (l2 hits).