Excel pivot showing row named "unknown" - pivot

I am trying to create a pivot using ssas cube. but I am seeing a row with label named "unknown".
I have checked the data in sql database and haven't seen any blank rows in the table.
Refer to below image.
I would like to remove unknown row.

Maybe the unknown record is not on the Excel side, but in your data warehouse. The data warehouse with which the cube is built on should be set up with a key that will account for any "blank rows" in your Fact/Dimension joins. I would check those tables first for an "unknown" record, then trouble shoot the load of your Fact Table. Perfect book to read. The Data Warehouse Toolkit
For instance,
SELECT *
FROM dbo.DimProduct
WHERE ProductKey = 1
SELECT *
FROM dbo.DimCustomer
WHERE CustomerKey = 1
will result in ...

Related

Excel Power query logic to get data that does not appear using logic

I am currently working on a report that shows a list of depot with the total of reports based on thier performance. the query only shows the depot that matches the conditions set in the query and the other depot does not show.
The report is connected the the raw data using power query in Excel which is then used to connected to the pivot table and graphs/ charts which makes up the report. Now we still want to show the list of ALL the Depots regardless of if they appear or not in the report.
The logic I would like to have is the below:
If the depot in the list (List of ALL of the Depot) appears then show all the values Else if values: UIS, LIT, LIG does not appear in the list of ALL the Depot include them in the list of depot in the pivot table as UIS, LIT, LIG with values 0
I am just not too sure how to go about this in Excel Power query, how do I write this logic. Sorry I am fairly new to excel power query. Also if there is no way this can be done in power query then would a macro be able to write into existing pivot table which is connected to power query?
Current Output:
Desired Output:
This is how the structure of the table looks like in Power Query:
In summary I do need all the values with no data to show so example : in the Depot column as per below the highlight in yellow has no values. if you also noticed the report tab skips from Report 1 and to 3
show all values with no data.
this option is greyed out in the pivot table option.
You may use the following approach:
let
Source = YourTable,
final =
let
a = Table.ColumnNames(Source),
b = Source[Depot]
in
Source
& #table(
a,
List.Transform(
List.Difference({"UTU", "LIT", "LIG"}, b),
each {_} & List.Repeat({0}, List.Count(a) - 1)
)
)
in
final

Cannot find the connection created in power query in pivot table connection

I created a connection appending two tables from power query. Now, I want to update my existing pivot table with the connection. But, I cannot find the option in the "Change data source". But, if I check it in the connections options in the data tab, then, I can see the connection I created. Please help!!!
If the Pivot table is based on the Data Model, then the "Change Data Source" button will be greyed out, because the data source for the Pivot table is the Data Model.
If you have appended two queries, it may well be that all you need to do is refresh the pivot table.
In the following scenario, the first screenshot shows the pivot table when only the table on the left has been loaded to the data model.
In the next picture, the table on the right has been added as a query and saved as a connection. Then the table has been appended with the existing "myQuery". Then the Pivot table has been refreshed and the numbers show that it includes the new data values.
If you want to change the data source for the pivot table when it is sourced from the Data Model, you need to work in the PivotTable Fields panel and select the table or query that you want to use. In the screenshot below, you can see that the pivot table uses fields from myQuery, but I could also select fields from Table1 and Table2, which are the original tables in the grid.

POWER BI - RLS - Analyze in Excel connection

I am now experimenting with "Analyze in Excel" feature in POWER BI. I would like to use the RLS to load RLS filtered table (NOT to actually analyze the OLAP Cube with pivot table)
I have successfully set up row level security using this Table filter DAX expression:
SEARCH( userprincipalname(), [Email], 1, 0 ) > 0
After creating a dummy Measure=1 I was able to double click ("drill through") the Pivot table (by double clicking on the measure value in the pivot table). This gave me a linked table with the following command text:
DRILLTHROUGH MAXROWS 1000
SELECT FROM [Model] WHERE
(([Measures].[Measure],[Table1].[email].&[xxx#xxx.xxx],[Table1].[ID].&[4],
[Table1].[X].&[654]))
After removing the filter part =>
DRILLTHROUGH MAXROWS 1000
SELECT FROM [Model]
WHERE (([Measures].[Measure]))
=> I was able to get a linked table with all the columns and rows. Also the RLS works: when I refresh from a different account I see only the allowed/limited rows. - Amazing! (Using Office 365, signed-in account)
This is how to get the linked table:
double click on measure in OLAP Pivot in Analyze in Excel file from POWER BI
My goal was to set up a linked EXCEL table with working RLS (without using MS SQL server or other) - this seems to work now!
My questions are:
Will the connection obtained via "Analyze in Excel" be working PERMANENTLY or is it only TEMPORARY?
Can I modify the "SQL" command text even more to return the whole table/data set? Something like "Select * From ... " - (of course while respecting the RLS)
Is this approach reliable? Can you think of any downsides?
Could someone exploit the connection to ignore the RLS?
Warm regards.
Jakub

Populate a second table from a source table using 3 matching criteria in the source table

I am trying to populate a second table from a source table using 3 matching criteria. This is one of many files that I need to do this on a monthly basis. If I have to include the name manager as one of the options, then I will have to create new "Names" every month. I am not sure.
The sample s/sheet shows the source table and the results table. https://1drv.ms/x/s!An8dvvJR5cTfhLJefK-KPaXujRymkg
Your biggest problem is that you are entering data into a report layout and then you want to report on that report. That is always difficult.
The best-practice approach is to unpivot your source data into a flat table. Then you can build any report you like with just a few clicks.
Ideally, your source data should have columns for
company
month
"type A" ( -- this should be either budget or actual)
"type B" ( -- this should be Net revenue or Contribution margins or Net earnings)
value
If your data is in a flat table like this, you can build the report in the top of your sheet and you can build the report in the bottom of your sheet with a pivot table and just a few clicks.
I don't support bad data architecture, so I won't post formulas to convert the top report to the bottom report. The whole idea is just wrong.
If your data input is in the shape of the top report, I strongly suggest you look into Power Query for getting the source table into a format that can be used for follow-on reporting.

How to add data to an existing power pivot table?

I'm looking for a way to load more recent data as date x in Power Pivot and link/add them to an existing table.
Background:
The user downloads data from a datafeed and saves them in Excel Power Pivot.
The data will be deleted from the server afterwards.
In the next step, new data must be added to the existing table in Power Pivot,
so that the workbook graphics can access the complete dataset.
I know there is no API for VBA access to Power Pivot. Is there a
workaround with linked tables and direct access to the database?
1) you create one table just containing the dates from earliest to far into the future
2) you import every new set of data into a new power pivot table
3) you link the dates for a record in the newly imported table to the dates in the power pivot table containing the dates
so the backbone of your whole data is the dates table, while your tables keeping the actual data are treated as lookup tables.
this is hacky and I didn't try it, but it should work

Resources