I have a data frame with columns having different lengths and they have some common components.enter image description here
I want to create a new column that is a union of all the current columns and fulfill the other columns with NA values.enter image description here
Related
I have two tables Names as like TableHead and Tableasist
From these above two tables I want to get one table result like below:
I explain result table column conditions in below
Conditions:
Get all records where MICR04 value 122 and above this is first condition
Select * From TableHead where MICR04 >= '122'
Date time: this column should be get as it is no condition
Parameter Name: I have to change column name as parameter and all values fill like MICR04(header of first table of 2nd header)
Set Value: this value get from Tableasist (2nd Table) of Set Temp value 120.. so should be filled 120 in all rows like below
Process Value: process value means MICR04 column value where we get all rows
HighLimt: This value fixed like 150 (Put as it is 150)
Deviation: devation = (High Limit – Process Value)
Event: we can take Event value from first table as usual
These result table unknown columns can add after Event in first table so that I will append these table to gridview. I will hide remaining columns.
You can cross join two tables as follows:
Select th.datetime,
'MICR04' as parameter,
120 as set_value,
TH.MICR04 as process_value,
150 as high_limit,
150 - th.micr04 as deviation
Th.event
From TableHead th cross join tableasist ta
where th.MICR04 >= '122'
I have data like
Table1:
YEAR PD REAL_GDP REAL_PRIVATE_CONSUMPTION
2018 0.007509274 140712.6 78450.8
Table2:
description value
Debt_service_ratio_paid 0.06
Personal_disposable_income 0.000000005
Intercept 2.0004
Real_GDP -0.004
Debt_service_ratio_paid 0.06
So basically some Columns of table one are rows in table2 . I want to multiply value of for ex. real GDP so output should be 140712.6*-0.004....
I tried unpivot.. but the problem here is wanted to calculate this for those column only which are common in table 1 and table 2 .... and rows will be added in table two in future ... so I wanna know if there is any solution for dynamic unpivot where I can take common columns of both the table and those columns only I need to unpivot in first table.
I have a database where all of the input from the user (through a userform) gets stored. In the database, each column is a different category for the type of data (ex. date, shift, quantity, etc) and the data from the userform input gets put into its corresponding category. For some of the data, all the data is the same except for the quantity. I was wondering how I could combine these rows into one and add the quantities to each other for the whole database (ex. combining the first and third data entries). I have tried playing around with a couple different loops but can't seem to figure anything out.
Period Date Line Shift Type Quantity
4 x 2 4/3/18 A 3 14 18
4 x 2 4/3/18 A 3 13 12
4 x 2 4/3/18 A 3 14 15
Thank you!
If you're looking to modify the underlying database, you might be able to query the data into the format you want by including all the other columns in a GROUP BY statement, save the result to another table, then replace the original table with the properly formatted one.
If you have the data in Excel and you just want to view it with the duplicate rows summed, a Pivot Table would be a good choice. You can select all the other columns as rows for the Pivot Table and sum of Quantity as the values.
I have a powerpivot table that contains 2 columns:
Column 1 contains strings.
Column 2 contains comma delimited strings.
I would like to be able to display all the rows from column 1 when rows from column 2 contains the selection from a filter or slicer. For example:
String Values
ABCD A,A,B
EFGH A,C
if A is selected I would display both rows, if B is selected I would display only row 1...etc.
I know I can split the records - but this is not practical for me - the above is only the top of the iceberg. VBA is out of the question since this will published in SharePoint. Anybody has an idea on how I could do that ? Thanks.
I found the solution in a blog from Javier Guillem:
http://javierguillen.wordpress.com/2012/02/10/simulating-an-approximate-match-vlookup-in-powerpivot/
If in my example the name of the table is "facts", I create a second unlinked table called dimRef that I populate with all possible values that I am interested to match: A,B,C,D...etc.
Then I define the measure M as:
M:=If ( Hasonevalue(facts[Values] ),
Calculate (
LASTNONBLANK (dimRef[String], 1 ),
Filter ( dimRef, SEARCH(dimRef[String],Values(facts[String]),1,0) > 0 )
)
)
I can then use the string column of the facts table and the measure in a pivot table and use dimRef as a selector. If filters the row as per the selection.
One small detail: the measure is not available in PowerView...Anybody knows why ?
How to add two cloumns with the same name from different tables. It needs to be dymanic, because i have columns based on months. Below is the sample data. which i would use to calculate the moving 12 month average for attrition.
Transferout Oct'11 Nov'11
3310ED
3310FL
3310HD 1
3310PZ
3310RC
3310SH
3310SM 1
Terinations Oct'11 Nov'11
3310ED
3310FL
3310HD 1
3310PZ 1
3310RC
So according to the column name and dept id in the row filed the above two tables needs to be added and later divided by the head count of the respective dept ids using the same column headings in a diff table
Looks like you can use the LOOKUPVALUE function or the RELATED function (if the tables are related).