MS Access pie charts - base query advice? - ms-access

I have some data that I want to display in a chart:
Theme Type Count(Type)
Blah1 1 5
Blah1 2 5
Blah1 3 8
Blah2 1 1
Blah3 2 5
Blah3 3 10
Blah4 1 111
Blah4 2 222
Blah4 3 333
I want to display that query data in a Pie Chart, one chart for each theme with a section of pie for each Type (with the value of the count determining the size). Unfortunately my mind has gone blank. Everything I try does not appear correctly, some queries also require an repeated entry of the parameters but even if I do that it doesn't display correctly. I think I need to write another query to the format:
Theme Type1 Type2 Type3 Type4
Blah1 5 5 8 1
Blah2 1
Blah3 5 10
Blah4 111 222 333
Is that correct and does that make sense? If it isn't correct how else do I do it?
I haven't done charts before and I am struggling a bit - many thanks for any help.

Try to put your data in columns. This is what I did. You can see the selection I had when I inserted the pie chart:
For more charts you can either copy the data and just replace the last column with the numbers. Or you could also copy the inserted chart and change the source data (when you click on the pie part you see the source data in the worksheet - you can drag it to a new area).

I ended up creating a crosttab query to produce the data in the following format, as you suggest it needed to be in the similar column layout:
Theme Type1 Type2 Type3 Type4
Blah1 5 5 8 1
Blah2 1
Blah3 5 10
Blah4 111 222 333
I am relatively experienced with Access - just not charts unforunately!! Seems so simple :(

Related

Convert CSV to nested object back to CSV based off previous and need data in PowerShell

First off, that title may be a little confusing, and not sure how to word it. Please edit it if you need to.
I am tasked with getting logs from a printer, and creating a cumulative report. The printer does not have the ability to supply date ranges, so I need to factor that in. My approach is to take the CSV, and then convert it to a nested object (XML or JSON), so each user can have it's printer's properties. Then I need to turn it back to a CSV and have the different months. If a CSV could not work, maybe I can use a XML, which I could leverage in PowerShell and create some custom report in HTML.
For example, this is what one month would look like
PrinterLog-Sep10.csv
User Name Dept. ID Color Total Black & White Total Total Prints
--------- -------- ----------- ------------------- ------------
Mary Smith 1002 3 3 6
Kevin Hart 1006 3 2 5
Jeff Davis 1004 4 0 4
John Doe 1001 0 0 0
Joe Dirt 1003 0 0 0
Jane Jones 1005 0 0 0
I also need to factor in that additional users may be added at anytime. So the following month could be like this
PrinterLog-Oct19.csv
User Name Dept. ID Color Total Black & White Total Total Prints
--------- -------- ----------- ------------------- ------------
John Doe 1001 2 5 8
Joe Dirt 1003 7 15 8
Jeff Davis 1004 6 4 7
Mary Smith 1002 6 7 5
Will Smart 1007 32 12 43
Jane Jones 1005 3 14 2
Kevin Hart 1006 6 7 10
My approach has been using this foreach loop, but I cannot think of how to check for news, and keep the existing data.
foreach ($user in $canonCSV) {
$final += #{
$user.'User Name' = #{
"B&W" = $user.'Black & White Total'
"Color" = $user.'Color Total'
"Total" = $user.'Total Prints'
"Dept" = $user.'Dept. ID'
}
}
}
I was thinking maybe exporting the nested objects into a XML or JSON, but when I import it, not sure how to flatten it to a CSV. I tried using Compare-Object but that is not working correctly for additional users. I'm literally losing sleep over this, as I cannot think of a way to get this right. I'm sure it is something small or trivial, but everything is slipping my mind. Any help is greatly appreciated.

How to create complex JSON config maps in q?

Is there a good way in q to input somewhat large complicated nested dictionaries which represent/will be converted to json? I'm trying to control the echarts javascript library which basically just renders charts based on json config options. What I'm doing now is:
opt.title.text:"my chart"
opt.xAxis.data:til 100
opt.series.data:100?5
opt.series.type:`line
toClient[opt] /serializes and sends to browser
but is there an obvious way to get rid of the intermediate assignment? Is making a function to take key-path/value pairs and turn them into a dictionary the way to go or is there a better way to go about this?
Or is this something that should be avoided in q, and instead just manually set write q to set specific options and handle the json object map in the javascript client?
Not sure if this is really what you are looking for, but you can create the nested dictionary structure directly if that's what you're after?
q)`title`xAxis`series!(enlist[`text]!enlist"my chart";enlist[`data]!enlist til 100;`data`type!(100?5;`line))
title | (,`text)!,"my chart"
xAxis | (,`data)!,0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ..
series| `data`type!(0 1 1 3 3 3 2 2 4 1 3 3 1 4 0 4 4 4 2 4 3 3 4 0 4 0 0 1 0..

Add blank row to MySQL array at a specific point

I am pulling data from a MySQL DB, it is ordered by the serial number, however I want to add a blank row after one of the fields drops below it predecessor. for example.
Serial No. Hours. type
11111 5 1
11112 7 1
11113 12 1
11114 5 1
What I want is ...
Serial No. Hours. type
11111 5 1
11112 7 1
11113 12 1
Null Null Null
11114 5 1
Because the hours have dropped it add a blank line.
At the moment I use a simple Array to pull the data then loop it.
Thanks.

Microsoft access iff statement

I've been making an award system in ms access but trying to use the if statement for 2 distinct parameters, i.e. in one class top 3 students get a different amount from what the top 3 students of another class might get. All the data of all classes is in one table.
See:
Student ID Class ID Average Rank Awards
1111 Form4 77.79166667 2
1189 Form4 105 1
1222 Form4 73.41666667 3
1234 Form4 69.95833333 4
1235 Form 3 77.16666667 3
1236 Form 3 72.875 4
1258 Form 3 82.54166667 1
1333 Form 3 77.25 2
1367 Form 2 56.54545455 4
1445 Form 2 75.66666667 2
1447 Form 2 75.72727273 1
1465 Form 2 74.18181818 3
1523 Form 1 76.18181818 3
1542 Form 1 75.51515152 4
1552 Form 1 79.03030303 2
1555 Form 1 79.63636364 1
at the awards column when creating a query the build formula I use i.e. IIf([Rank]=1,1100) gives all student IDs ranked 1 an award of 1100 but I want only form 1 student IDs to get 1100 and the others ranked 1st with different award values please assist.
I think you want something like:
IIF([ClassID] <> "Form 1", IIf([Rank]=1,500), IIf([Rank]=1,1100))
Obviously, you will have to edit the award amount since you didn't specify what you were giving, but the logic should hold true.
If this gets a bit more complicated, you can write a function in VBA (in any code module in the 'modules' section), and use it in the query:
ExpressionName: evaluateAward(ClassID, Rank)
In the function, you can then use nested select case statements. This may be much better for readability.

Group data on X-axis

I have a SharePoint list with 5 options (questions). Each option has a dropdown with values 1-6. The user (employee of a company) needs to select an option, then select a value from the dropdown and hit Submit. The selected value is unique. In other words, if the user selects the value 1 for the first option, that value cannot be chosen again. Here's an example form -
Category Rank
------------------------------
1. Work/Life Balance 4
2. Compensation 2
3. Commute 3
4. Work 1
5. Development 5
After filling the form, the data looks likes this on the Sharepoint list -
Employee Manager Work/Life Compensation Commute Work Development
--------------------------------------------------------------------------------
1. Employee 1 Manager 1 2 4 3 1 5
2. Employee 2 Manager 3 1 3 4 5 2
3. Employee 3 Manager 1 5 4 2 3 1
4. Employee 4 Manager 2 4 1 5 2 3
I'm able to get the Y-axis (for Rank) on the report just fine. The X-axis needs to display each category grouped by each Manager. Here's a sample of how I want it to look like -
Each colored bar on the X-axis is a Manager. This is my first time with SSRS (2012) and I'm just not sure how to accomplish this. If this is not possible, will moving the data to a SQL table in a different layout help? Any help is greatly appreciated.
You could aggregate each employee's response into an average in your dataset (I'm assuming you know how to do this):
Averages (just pretend)
Manager Work/Life Compensation Commute Work Development
--------------------------------------------------------------------------------
1. Manager1 2 4 3 1 5
2. Manager3 1 3 4 5 2
3. Manager2 4 1 5 2 3
Then you can use the categories as you have, with the manager as the series field. Pretty sure that should achieve what you're looking for.