Excel column order from powerpivot - database

How can I rearrange column order from powerpivot data model? Unchecking/checking Preserve column sort/filter/layout doesn't work.
For example in powerPivot I have something like this:
col1 | calculatedCol | col2
But in Excel table:
col1 | col2 | calculatedCol
Drag and drop columns in diagram view also doesn't work.

You can rearrange columns order in the Data View window itself by selecting a column and then dragging to the desired location. Doesn't it work for you?

Is your issue that the Data Model and your Excel table don't match? Have you tried adding the table again, or just rearrange the columns in Excel to match your Data Model?

try to select the cell with the column header in the pivot table and horizontally drag it to its new position

Related

Google Sheets - Flattening a table into two columns, but returning results based on varying conditions

My table has data similar to the following:
Raw Data
I am flattening the data into two columns using the following:
=INDEX(QUERY(SPLIT(FLATTEN(IF(SheetName!B1:D=TRUE, SheetName!B1:D1&"×"&SheetName!A1:A,)), "×"),"where Col2 is not null order by Col1 asc"))
The result is depicted here:
Flattened Data
However, I also need to return within the "flattened data" columns the following:
1#email.com | 1#email.com
2#email.com | 2#email.com
3#email.com | 3#email.com
In other words, I need to return SheetName!A1:A&"×"&SheetName!A1:A for each email address contained in the email column (Column A), in addition to the other data that is being flattened into the column. I have tried variations using IF/IFS statements, wildcards (not permitted within IFs), etc. However, I am now seeking some help after striking out many times. Thanks for any help you can offer!
Update Example spreadsheet with sample data and current vs. desired results (formula in cell H2):
https://docs.google.com/spreadsheets/d/1wq9kR4UqYeWsqSCbnkGGHbR-TIHTfaBb_ixGk41X2cs/edit?usp=sharing
perhaps:
=INDEX(QUERY(SPLIT(FLATTEN(IF(SheetName!B1:D=TRUE,
SheetName!B1:D1&"×"&SheetName!A1:A&"×"&SheetName!A1:A,)), "×"),
"where Col3 is not null order by Col1 asc"))
update:
=INDEX({QUERY(SPLIT(FLATTEN(
IF(Sheet1!B1:F=TRUE, Sheet1!B1:F1&"×"&Sheet1!A1:A,)), "×"),
"where Col2 is not null order by Col1");
TEXT(UNIQUE(FILTER(A2:A, A2:A<>"")), {"#", "#"})})

Converting two columns table into one column table in Google Sheets

In column A there is a list of tasks.
In column B each task has an associated group.
How to, using built-in formulas, generate sequence like in column D?
Here is a screenshot :
try:
=ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(QUERY(IF(A2:B="",,A2:B&"♦"),
"select max(Col1) where Col1 is not null group by Col1 pivot Col2", 0)
,,999^99)),,999^99), "♦"))))
This should work as well as player0s. I keep trying to get him to use FLATTEN() :)
=QUERY(FLATTEN(TRANSPOSE(QUERY(A2:B,"select Max(A) group by A pivot B"))),"where Col1<>''")

Automatically produce aliases for all columns in SELECT statement

I'm using Microsoft Query to pull data from MS SQL Server to Excel. Many of my tables have the same column names, for example:
[task].[active]
[user].[active]
[task].[name]
[user].[name]
When I pivot in Excel, only the column names are shown. A pivot filter might have multiple fields called "active" which is very confusing.
I'd like to alias every column with the table name it's from, so that in the filter it would say "task_active" and "user_active". My Excel SELECT statement would be:
SELECT active AS task_active, name AS task_name FROM task...
Is there a quick way to prepend the table name to an alias using a formatting tool? I have Apex SQL Refactor, and Notepad++ but I haven't found a way to do this without having to manually type all of the column names again.
If you populate resultset to datatable then datatable to excel then it will automatically change duplicate column name to col1,col2 etc.
This is not your requirement.you want it to be specific.
Method 1 . Create temp table with desire column name
Insert the result in #temp table
Return #temp table result set
Method 2 : Use dynamic query.
Wht your real query look like ?

Combine data sets in SSIS based on columns

I have a data set which is of following format in excel
Col A Col B WW1 WW2 WW3.... WW51 Ww52
The columns A & B has text values and WW1 to WW52 has numeric values. This data is unpivoted to the following format into a SQL staging table
Col A Col B CurrentWW WorkWeeks Qty
The WorkWeeks column will have 52 workweek values including the current work week in the format yyyyww and Qty as numeric. A sample data set will look like as follows :
ColA ColB CurrentWW WorkWeeks Qty
US01 ABC 201717 201717 1
US01 EFG 201717 201718 1
US01 HIJ 201717 201719 2
and so on.. until the 52nd workweek starting from 201717.
How can I achieve this in SSIS?
I have tried the following options - Lookup,Merge Join,Union all.. but it joins with the first row only. I know Im very close but still missing something. Any help would be appreciated.
What is your end result (flat file, Excel file, sql table, etc)? You could always load the Excel file into another staging table and then join the two tables using SQL. That may help reduce the complexity since I know joining two sources with SSIS can sometimes be a pain.

How to show data in column in SSRS

I'm using SSRS for my reporting, my reporting solution is in Visual Studio 2008 Business Intelligence Development Studio.
I have a report in which the data should be displayed in this format.
I have added a Column Group in my table which is having the values of Customer Name and details, the data is coming fine in the vertical format i.e column after column.
My Issue :
There should be only three columns in each row, after three records the next row should begin and again not more than three records should be displayed as shown in the image above.
My attempts :
I tried to add a row group and in that gave the expression
= Ceiling(Fields!Row_Count.Value/3)
here Row_Count is a field which is coming from my query which holds the serial number of the records.
My SQl Query
SELECT Row_Number() over(order by table_ID) AS Row_Count, Field_1,Field_2 from MyTable
In my Column group i have Customer Name and in my Row Group i have other details of the customer. The data is getting populated column wise but the issue is its not breaking the current row after three records.
Below is my table of report.
You were on the right track. Say you have data like this:
I have created a tablix like this:
The Row Group expression is:
=Ceiling(Fields!Row_Count.Value / 3)
This works together with the Column Group expression to split over three columns:
=(Fields!Row_Count.Value - 1) Mod 3
The other thing to note compared to your tablix is that CustomerName is not in a table header row, but rather there are two row header rows, one for CustomerName and one for Details.
This is looking OK to me, obviously you can format to taste:

Resources