Jasper grouping not grouping all common dates together - only some - jasper-reports

When I group according to date in Jasper, same date entries do not get grouped together.
For example, if I have 3 entries with the same date, two get grouped together, followed by a group of a another date, and then the one that was supposed to get grouped with the other two gets a whole new grouping of it's own later...
How do I get the same dates to all group together?
I'm using an oracle database.

To use grouping your data must be sorted firstly by the grouping field i.e. the field you want to group data by must be the first column in your ORDER BY clause as groups are created per occurence of the grouping field. So if the occurrences of the grouping field are not continous you will get multiple groups of the same grouping field.

Related

How can I filter by a group of individual dates in Google Sheets?

I have a group of individual dates on one sheet, and I'm looking for a quick way to filter by each individual date (not the range) on another sheet.
Group of individual dates
Values I'm trying to filter
Thank you.
I tried separating the dates by comma and putting them into the 'filter by - exact date' part of the filter tool. It will only recognize one date, not multiple.
I'm guessing what you may want to do. But if you want to filter by formula your range according to the dates match your second range you can do something like this:
=FILTER (Sheet1!A:O,INDEX(IFERROR (MATCH(Sheet1!A:A,Sheet2!A:A,0))))
Change the ranges accordingly. I used sheet 2 as the set of dates you wanted to filter by

Tableau Count Distinct when graphed shows chronological last date, when deduplicated, not first

I'm doing a break fix on a Tableau report visualization that shows the outcomes of clients by client id for a given year by showing a running sum of distinct count of client id or RUNNING_SUM(COUNTD([ID])). The X axis of the visualization is the initial date of contact with the client. Occasionally, due to errors in the data or weird behavior, there are clients that have two initial dates, listed as two separate data rows where the column Initial Date will have different values but they will share an ID.
Currently, the visualization shows such people with their chronological last Initial Date and I need it to dedup such that the visualization shows them as starting from the chronological first Initial Date.
I could create a calculated field for if there are two IDs with multiple non identical Initial Dates then use the first, but I'm not sure how to create a calculated field that can groupby or otherwise check multiple dates per ID.
In Python/psuedo code, it would be something like
For ID in IDS:
if len(groupby.IDS.ID)>1:
then Initial_Date = min(InitialDate)
But I have to do the transformation in Tableau
Keep everything the same, but create a calculated field named "Initial Contact Date" with the calculation:
{FIXED [ID]: MIN(InitialDate)}
Then replace the date field on the X axis (Columns) with this date field instead.
That LOD Expression loops through all rows given the ID, and returns only the min one.

Tableau - YTD, MTD as columns in text table

I'm trying to find a way to create a table like the one above, but instead of having columns of months I would like to have columns of MTD, QTD, YTD for all selected measure values. I created calculated fields on the [Date] field but when I try to use that it still splits the data in to separate columns of months and quarters... I'm using two data sources and they are linked on the [Date] field. If I try to put two of my calculated fields in the columns bar it just combines them like 'MTD/YTD'. How can I get them to display as separate columns?
I know this is strange because there will be overlapping data (everything in the MTD will also be in the QTD and the YTD).
I found a way to do this. I created a calculated field on the date field and assigned 'MTD' to all records from the last month. Then I assigned 'QTD' to all records from the start of the quarter to the day before the start date of the 'MTD' records. Then I assigned 'YTD' to all records from the start of the year to the day before the start of the 'QTD' records. (this way there are no overlapping records).
After that I just did a quick table calc to make each of them a 'running total' table (across).
I created parameters for the dates so the can easily be updated.

Group data by multiple columns

My SQL query needs to return data grouped by requirement. To do so, it needs to group by more than one column.
Example SQL:
SELECT
[MainMenu],
[Submenu1],
[Submenu2],
[Submenu3],
[Submenu4],
[Submenu5],
[Submenu6],
[Submenu7],
Sum([MainMenuReturn]) AS "Total Returns",
[ExitReason]
FROM [dbo].[Custom_IVRMenuUsage]
GROUP BY MainMenu,Submenu1,Submenu2,Submenu3,Submenu4,Submenu5,Submenu6,Submenu7,ExitReason
This will return each combination of the groupings and keep the column separated data. I cannot do this in Crystal. If I concatenate the columns into one field to group by, I lose the ability to keep the data separated into their columns for formatting.
How can I accomplish this in Crystal without writing a separate stored procedure?

Can not sort month-year column?

I have a date column. I created Month-Year column in my report using the following expression, but I am not able to sort month-year wise.
=MonthName(Month(Fields!new_sitevisiteddateutc.Value))& "-"& Year(Fields!new_sitevisiteddateutc.Value)
I would like to have MAY-2009 JUNE-2009 JANUARY-2011 MARCH-2011, however I am getting JUNE-2009 MARCH-2011 MAY-2009 JANUARY-2011.
Can someone help me with this?
In the table properties you can add multiple sorting fields and thier order.
Sort by year first and then month.
=Year(Fields!new_sitevisiteddateutc.Value)
=Month(Fields!new_sitevisiteddateutc.Value)