Order a grouped column - ag-grid

Is it possible to change the order of a column that's used for row grouping?
e.g.
Country, Account , total
Group rows by Country but display like this:
Account, Total, Country
This can be done manually after the grid is rendered but cannot find a way to render it with this ordering.
I couldn't find an option to order this column to the end of the grid since this column is auto generated by AG-Grid
many thanks
Rob

Related

How to have 'Pivot Row Totals' in server-side rendering ag-grid pivot mode

I use ag-grid enterprise edition and I would to add total columns in pivot mode. It is very clear in document how to do so but not in server-side rendering. The idea is that the back-end calculate the total of values for each row and I want to show it in the grid.
I tried a workaround using custom row groups and adding new columns to columnDef to describe the total columns, but it's not showing in the grid, because the total is not a row group. I can't find in the API a method to add a column that is not a Value column or a Pivot column in the ag-grid in pivot mode.
I want to know is someone find a way to do it in this context.
Nevermind, I find how to do it. You just have to push the columns you want as total using gridColumnApi.setSecondaryColumns. It's important to be aware of the colId and field to match the key of your row data corresponding.

Dynamically render multiple columns based on a drop-down list

I have a table in tableau with say 4 columns (Say Employee ID, Name, Address, Email).
I want to provide the users an option to select single/multiple columns from a drop down list (assume in the drop down list we have columns headers, Customfield1, Customfield2.....,Customfield10) which would be added to the table as a separate columns.
Say for Instance if the user selects CustomField1, CustomField2, CustomField3 from the drop-down list then the table should have in total of 7 columns (4 Emp fields + 3 Custom Fields)
Though I stated a simple requirement, my idea was to extrapolate that to something complex.
I think some version of this could be done, albeit in a hacky way. What you're looking for is 'Dynamic Parameters.' They don't technically officially exist in the product, but can be created with the combination of parameter and calculated field.
Here is a link to a method on such creation.
The idea here would be to re-order columns in a custom manner. Each calculated field would have to have its own logic for which dimension it was to display when a user selected a parameter. (ie: With parameter selection A Column 1 goes to [Name] and Column 2 goes to [Address], and with parameter selection B Column 1 goes to [Address] and Column 2 goes to [Name].) The caveat here is that each potential layout would need to have the same number of columns - there is not a way to add columns dynamically. Consider that each column is represented here with a calculated field.
Good luck on it.

Tableau - add row without making it a subset of previous row

I want to add rows to a Tableau text table without making the row a subset of the previous row. Using the example below, I want values for teams and status to display on separate rows rather than status appearing as a subset of team. I also want to add a team filter so that if I filter on team blue, values for green row are zero and status values update . Is this possible? I tried creating separate worksheets but keeping things aligned is problematic.
Example Data:
Desired text table:
What I don't want:
Select both the fields(team, status) simultaneously then right click and go to Transform > Pivot.
Then 2 Dimensions will be created. Drag the Pivot Field Values on to Rows section
and Year on to Columns section and keep Year in Discrete format.
Then drag Number of Records on to value field section.
Before Pivot:
After Pivot and final viz:

Displaying only 1 row for duplicated data in tableau table

I have a table that displays 8 columns. Due to the way the data source is structured (I cannot change this) it sometimes means one or more of the columns will be the same across two rows.
I need to filter to show only one row of data. This is based on "email', so if an email has more than 1 row, I want one of the rows. If the other columns are the same or not doesn't matter.
I don't need to combine anything, and I don't care which row is displayed, I just need to remove one of the duplicated rows.
Replace this:
Place orderid email item name date
a 1 a#a.com b c 1/1/11
a 1 a#a.com d c 1/1/11
With this:
Place orderid email item name date
a 1 a#a.com b c 1/1/11
Or this:
Place orderid email item name date
a 1 a#a.com d c 1/1/11
Any help would be much appreciated! I had a go with LOD calculations and I couldn't make that do what I wanted (that may well be me not understanding how to use them properly, though).
Given your example, it appears the difference is within the [item] field. You can create an index calculation on it and filter for value of 1.
index()
Set the index to discrete and compute using the [item] and filter for only 1. You can hide the field if you don't want it to appear by deselecting Show Header.
If you want to show the first row per email, regardless of what's in the other fields, try the following:
Create an [Index] calc field using INDEX().
Add [Index] to rows shelf and change to discrete.
Edit the table calc for [Index], select 'Specific Dimensions' and restarting every email (dropdown menu). All of the checkboxes should be ticked by default.
Notice how the index is not restarting for each email as expected. To correct this, drag email checkbox to the top position.
From here, filter [Index] = 1 and hide index column from view.

Display Records Horizontally Instead of Vertical in Cells, SSRS

I'm trying to display multiple values for one drive by adding a column for each additional record assigned to a drive. For example, a drive ID is unique but can have multiple promotional incentives assigned to it.
For example, if we go to a university on 1/23/2015, that will a unique event or record in the DriveMaster table, but if we are giving away T-Shirts and Pizza, those two records will be assigned to the drive in the EquipmentDetail table.
In SSRS, I'm trying to create a sub-report that will display the promotional items on one line instead of adding additional lines for each promotional item. See screenshot below.
What I'd like to have happen is have the each drive only account for 1 row, and each promotional item listed in a new column to the right. See mockup in Excel.
Is there a way to handle this? I know there is in Crytal Reports, but I can't figure this out in SSRS. I've tried using a Matrix, but I can't see to get the columns to grow if there are multiple incentives.
I added a column group on the Description field, and it looks like that it is close, but that the grouping will create blank spaces (cells) in it.
Thanks,
You have to set a Column Group for your promotional item in your Matrix.
Hope that helps.
Edit:
It looks like there are some areas that contain no data (because of your groupings)
We can do something like the following:
In your query you can use the 'over'
Select DriveID, PromotionItem, ... ,
ROW_NUMBER() Over(Partition by Select DriveID, PromotionItem, ... Order by PromotionItem)
AS ColumnGroupNumber
Then in the Promotion Item group that you have change the field it groups on to the ColumnGroupNumber (or whatever you are going to call it). Just don't change the field in the detail row, or you will not see the details.
I have used this solution before. I found it here.