How to transform a table to a new table after aggregation - spotfire

if you have Tabel = Table in Spotfire
you want to transform that that to new tabe with aggregation like this in R
I do not want to use R but I want to use Spotfire functions
aggregate(list(vals=Table$vals), by=list(IDP=Table$IDP, Year=Table$Year, Month=Table$Month,Cust=Table$Cust), FUN=sum)
aggregate(list(vals=Table$vals), by=list(IDP=Table$IDP, Year=Table$Year, Month=Table$Month,Cust=Table$Cust), FUN=sum)

It looks to me like you want to add a pivot table. Click File > Add Data Tables > Add, and then select the table you want to pivot. Near the bottom where it says transformations, click the drop down box, select Pivot and then click Add. You'll want to select all of the columns mentioned in the by parameter of the R code as row identifiers. Select vals for values, and it should default to sum as the aggregation method. You can also change the column naming pattern. Check out the sample at the bottom and click OK until you've closed out the Add Data Tables window.

Related

How can I generate a pivot table using this data?

I have this table:
Is it possible to make a pivot table to present the information like this?:
Thanks!
Sure it's possible. As shown in your example, you just need to change the special character "✔️" by the number 1 using "ctrl + f". Then insert a Pivot Table with the data. And finally, create a new column named TOTAL and add the "=sum()" formula to count the items from each row. Something like that:
You are going to need to move this data from the word doc you are using into an Excel worksheet, in order to generate a pivot table.
format your data like this in Excel
To start out creating a pivot table, make sure that all rows and columns are selected and record (row) must not be obscure or elusive and must be making sense. Navigate to Insert tab, click PivotTable.
You will reach Create Pivot Table dialog box. Excel fills in data range from first to last selected columns and rows. You can also specify any external data source to be used. Finally choose worksheet to save the pivot table report.
The pivot table should appear. You can then populate this table with data fields which will pop up on the right hand side. Enable the fields you wish to compare in the pivot table report.

How to create a new table from Query data and change rows to column in Power BI

I am new to Power BI. I have searched a solution, but I can't find the one match my issue.
I use direct query to SQL Server to generate data table in Power BI. My query result as below:
And I want to create a new table and transform the data to be as below:
Really appreciate any help or idea.
Thanks
You need to pivot the Factory column to get the desired result.
In Power BI Desktop designer, click Transform data button from the Home ribbon tab to open Power Query Editor. First, delete the Comment column (or don't select it at first place) by right clicking on it's title and select Remove. You don't need it. Then select Factory column and click Pivot Column button from Transform tab:
and select Volume for values column:
This will pivot the column, i.e. make a separate column for each of the values in it, and give you the desired result:
In addition (you said you are using a DQ to get the data), you can also do the same transformation in the database query too.

Dataprep pivot transform

I'm new to Dataprep and now trying to create a pivot table using the "Pivot Transform"
https://cloud.google.com/dataprep/docs/html/Pivot-Transform_57344645#example---basic-pivot
I searched the documents and the syntax looks simple enough, except for the fact that it is out of context and not sure where to use it.
syntax is :
pivot col: (the parameter to be used as col) value: (value to present) group: (what to group by)
Other solutions that I found here and elsewhere all require lots of code and heavily rely on knowing the columns in advance
e.g : using case when ____ = 'name of col' to pivot the data
any idea will be appreciated
I'll assume that you have already imported the dataset with the data and then you created a new flow. When you add the dataset to the flow you can then add a recipe. You can find details on how to do so in the quickstart.
Regarding, the pivot transform, once you have added the recipe click on the Recipe button on top and then select Add New Step as depicted here:
Then, in the Transformation text box you can start typing pivot and select the Pivot transform as seen below. A menu will appear and you can apply the parameters using the UI.
Otherwise, you can just copy and paste the formula in the text box. For example:
pivot col:Date value:SUM(Sales) group:State
And the fields will be filled in and you can check the preview of the pivot transform:

Excel VBA Code for concatenating data in multiple columns and removing duplicates

In reference to the attached "Example Photo" Image...
I would like to concatenate the unique data in Columns I and K into one cell (separated by line break) and remove the duplicated information in the other columns. My goal is to have the data look like rows 2 and 7 without the duplicated rows in between.
You can download Power Query or if you have Excel 2016 it is a default its name is Get & Tranform in the Data Tab.
Select any cell in your main table.
Go to Power Query or Data and select From Table/Range.
It will be a box with the range OK.
It will open the Query Editor
Go to Home select Group by.
In the Options:
Group by: Add all the fields you don't want to concatenate.
New Column name: It could be "Group".
Operation: Select All Rows.
OK.
Go to Add Column select Custom Columna.
Concatenate field Name
[Column Named Step 5][Column Name where is the data to concatenate]
Go to the new field and click in the right corner (Arrows) and select Extract Values....
Select delimiter #(lf) OK.
Go to Home tab and select Advanced Editor.
There look for ""#(lf)"" and delete the extra "" it should be "#(lf)" click in Done.
Got Home select Close & Load.
It will create a new sheet with a table with your new data.
Use Wrap Text in Home tab to see the lines break.
You can append more data in the main table and it will be just a right click refresh in the Power Query Table and you will get your data.
I made this tutorial. It is in Spanish but I am using the English Excel version.

How can I turn part of the Excel data to columns to get a desired output?

For eg - Say I have data in the following format -
Current Format
I would need the data to be formatted in the following format for ease of use -
Required Format
Of course the data contains a lot more records - I'm looking for an easy way to transpose data in this way for large sets of data.
Any help will be appreciated :)
What you want to do is called:
Unpivot:
Select the data and on the Insert menu choose Table
On the Data menu click From Table/Range
The query window will open. Choose the columns you need to extract. With your data the columns to highlight are "Type" and "Number of Cases"
On the Tranform menu choose Unpivot Columns
If the data looks right now, close the Query Editor (accepting changes).
Examples here: Unpivot Excel Data
This is very easy with PowerQuery. It is inbuilt for Excel 2016 and a freely available add in for Version from 2010 to 2013.
You would set your data up as a table excluding the first row which contains the text Number of Cases (Ctrl + T whilst bring up window to create table)
Then from the data tab (Excel 2016) or the Powerquery tab (earlier versions) select data from table and use your newly created table as source.
Highlight the last 3 columns and right click > unpivot columns
Double click in headers section and rename Attribute as Type and Value as Number of Cases
Top left select close and load to
Select table and load to new worksheet (or existing)
View result

Resources