Calendar with crosstab in jasperreports - calendar

I want to create a crosstab in the form of a calendar (Years as first group and months as second group in the columns) with jasperreports. I'm using MySQL database.
1) The first problem is, I'm getting only the months where the measure exists, I want to display all months of the year wether the measure exists for this month or not.
2) Second, I want to have a seperate crosstab for every year in a seperate page.
3) I can't get the months in the right order, they're ordered in alphabetical order.
4) I'm getting a blank first page before the crosstab displays I wanna get rid of. (I'm putting my crosstab in the summary band).
I know these are too much to ask, but I really looked them up deseperatly without any result :'(

For most of this you can fix this in your sql.
1) see Get a list of dates between two dates
3) add a column to your sql and order by it. example SELECT MONTH('2008-02-03'); will return "2"
For #2 you can create a group in Jasper of year (you can create this as a sql column as well or use the java date functions) set the start on new page option for the group. then move your crosstab into the detail band.
i think #2 will fix the #4 problem as well.

Related

Power Pivot - Timeline linked to native Calendar Table can't be inserted anymore

I'm building a model in power pivot, and have so far 2 tables retrieved from API calls. I added a calendar, linked it to my tables, and it was working fine. I was able to add a timeline linked to my Calendar date field (not fact tables date fields).
Link to the Calendar table are seen by Power Pivot
Then I updated the range of dates of my Calendar table, to go further in the past, and further in the future. Since then, when I try to add a timeline linked to the Calendar date field, nothing happens. It's weird, because Power Pivot is seeing the relationship with the calendar table, when I add the Calendar date fields in the power charts (see image 1). It's really the timeline that's not appearing anymore. If I try to add original date fields from fact tables, then the timeline adds correctly but that's not what I want.
Steps to update Calendar date range
Clicking Okay does nothing, when it usually adds a timeline
I don't know if it's a bug in Power Pivot or I broke something?
The Excel model is below
Data model, with relationships to Calendar table
Okay so I found the solution to my problem after 3 days of research. Basically by adding the timeline outside of a pivot chart, linking it to my calendar table, instead of not showing anything, it showed the error message pretty much saying that dates were not supported in Excel. So then I figured my date format was correct as it's the native calendar table, so it was probably a problem linked to the range. After a few tests, it seems anything before 1900 is not supported in the timeline, same goes for after 2099. Adjusting the range fixed it!

Finding difference between columns in column group

I am using report builder to create a report showing a budget for a project. The dataset includes line items for both budget and projected. See below for example rows. I am using a matrix with column group to display budget and projected side by side as well as a row group to show section, category, etc. I need to have a variance column that subtracts projected from budget.
I have scoured the interwebs for solutions but nothing that has worked so far. I feel like there has to be simple solution to this given it is something that could be done in a sql query with zero effort. Most solutions are assuming I have two separate fields, but these are dynamic fields pull out with the column group.
Dataset Row Samples
Type Section Cateogry Phase Task Total
Budget Building Kitchen Pre-Construction Cabinet Hardware $100
Projected Building Kitchen Pre-Construction Cabinet Hardware $220
Report sample
COL GROUP This is the column i want
Budget Projected Variance
+Buidling $100 $220 -$120
+Kitchen
+Pre-Con
EDIT: I tried the below solution without success and have already visited every link provided in the second answer. Maybe there is something I am missing, but I ended up just doing everything in the SQL query and not use Column groups. This is 100% the simplest solution. I am very surprised there is no easy way to reference individual columns in a column group. The below may work for others, but I just could not get them to work for me. Not sure why.
You could add an additional column inside the “Type” group (provided that this is the name of your column group). Set the Column Visibility to hide the column by an expression like
= IsNothing(Previous(Field!Type.Value, “Type”)
Calculate the values for that column as
= Previous(Sum(Fields!Total.Value), “Type”) – Sum(Fields!Total.Value)
That should calculate the difference between the values of the previous type and the current type, and
only show that column for the "Projected" type (when there is a previous type).
On the matrix, you can use the group subtotals to achieve this, you only have to overwrite the SUM operation with an expression that subtract to values. There are many link mentioning how to do that or that can helps you:
How to add calculated column from dynamic columns to a matrix
Adding subtotals to SSRS report tablix
How to write Expression to subtract row Group SubTotals
Reporting in SQL Server – Using calculated Expressions within reports

Need to insert nested totals for text boxes in SSRS List Tablix cell

This article is SOOOOO close: How to create a report with sections and page breaks using SSRS, at this link: How to create a report with sections and page breaks using SSRS. Using a UNION between the tables we can get the vertical hierarchy we want, using the List Tablix. Using a LEFT JOIN between the tables, we can use a regular tablix to get the totals we want but we get all counties first, then all townships rather than as shown, County with its monthly breakdown followed by its townships with their monthly breakdown.
IF we can insert a total, somehow, some way ... it'll work OR if we can get the List Tablix functionality in a full blown Tablix, that should do it.
Need to get totals on these text boxes:
Here is where I need the totals:
Of course the answer was simple -- another developer and I looked at this and he tried another approach -- adding a row and then adding a total. Something like it was tried before but the total arrived at was for every payment.
What can I say? Overthinking is a disease ... find an intervention group! :)

Query in Sql server

I have a table which contains data of ledger. it contains field Account name,debit credit.
the data entered in the table at end of month ie. sum of all the days.
Here my problem is that i want to display data of two months i.e current month and the back month. the real problem is that it will be displayed in crosstab
Accname dated debit credit
------- ----- ------ ------
Account name will be in both the months and i want to display one entry from both the month and its corresponding data ie credit and debit field will fill. The query will work on two conditions fields the account name and dated which is to be checked.
Is it possible to use case statement in the query
PLease Help
SQL Server/SQL does not display anything by default. So it doesn't really matter in what form you return the data from your query, as long as it is then visualized the way you want it. Just write your query to return the required data and then care about the visualization.
It might also help us if you told us how you're planning to visualize the data.
To answer your question: Yes, you can use CASE within a query as in
SELECT
CASE WHEN <Condition1> THEN <Value1>
WHEN <Condition2> THEN <Value2>
ELSE <Value3>
END AS <FieldName>

How to arrange a daily time log entry form in Microsoft Access 2007 with Weekdays & Dates in the column headings

The objective is to create a weekly form, in Microsoft Access 2007, that allows employees to select their name from a list, the date of the first day of the week, and then create all daily time longs for the week in single form. The form needs to have a week view like the form (an Excel mockup) shown here:
Once entered, the data is to be written to the Project Time Log table shown here:
When the employee selects the "Week Starting" value, the column headings in the able below need to update. Is this possible? What also has me stumped is how to enter project hours for the week in a single row that will result in creating up to 6 records in my database. Finally, how does one set up validation on the "Week Starting" field so that the employee can only select Mondays?
I guess this is where I admit that I am just getting started with MS Access. However, with some experience in database design and Excel I am finding everything but advanced form building to be fairly straightforward.
So, can someone point me in the right direction? Do I need to use a Pivot Table to make this work? What is a Modal Dialogue? Could it be useful here? Any suggestions would be greatly appreciated.
The easiest way may be to create a table used solely for dataentry that can reside in the front-end for each employee.
DETable
EmployeeID
WeekStarting
ProjectID
Workcode
Mon
Tue
<...>
Sat
You can clear down the table and then append the relevant projectIDs and EmployeeID with a command button or suitable event.
The labels showing Mon, Tue etc can be updated to show the relevant date after WeekStarting is selected.
A suitable set of queries, or a UNION query will allow you to append the data to the main table.

Resources