How to transform multiple tables in one excel sheet to one table with Power BI? - pivot

I would like to transfer this humanly readable table either into one long table, for example through an "Attribute" Column which then includes "Category A" and "Category B" or I would like to split them into multiple sheets within PowerBI. The "delimiter" is always a empty column.

If I guess correct-
You have single spread sheet with data belongs to multiple category.
You wants to load whole data to Power BI
But you need separate sheet per category.
You can perform these following steps to achieve your required data sets in Power BI-
load the sheet to power bi
duplicate your data set as many time you wants number of data set
Go through all data sets and remove all columns except columns you required in current data set.
This should give you your desired data sets in power bi.

Related

Excel PowerPivot Measure For cumulative total (of only the visible cells in a Pivot Table) for underlying OLAP data

I am trying to provide on of our FHF fundraising campaign managers with a tool they can use to help them pick postcodes to send a campaign to.
Spoecifcally, I'm seeking help writing an Excel PowerPivot Measure for a cumulative total that counts only the visible cells in a Pivot Table and wherein the source data is OLAP (i.e. an Excel Data Model - which seems to carry some constraints to possible solutions)
The linked worksheet is a simplified example of the excel worksheet tool I want to give to the Campaign Manager in a Fundraising setting https://www.dropbox.com/scl/fi/3pfc8ix2ekduoocsa90zs/minReprodExample_share1.xlsx?dl=0&rlkey=m6gqf5zbjxhl6dzkjq653it3d
We have two predictive models both giving different predicted response rates per postcode
The 'data' tab contains the raw data
The 'modelA_pivot' tab contains a pivot table ranking the raw data according to the predicted response rates from ModelA
'model_pivotB' does the identical pivot for ModelB
Focussing just on the 'modelA_pivot' tab for now
you can see a slicer that allows the campaign manager to exclude postcodes with only 3,000 addresses
(or some other threshold level of their choosing)
The slicer's exclusion of a single postcode with 3,000 addresses in this example is why you see the rank column in the pivot run; 1, 3, 4, 5
(i.e. missing rank 2 postcode with 3,000 addresses)
In the pivot, the last column - 'addressCount_postcodeCumulative_modelA' - is based on an excel Power Pivot 'Measure'
And the current formula of the measure is
=VAR rankCurrent = MAX([rank_modelA])
RETURN
CALCULATE(
SUM([addressCount_postcodePer]),
FILTER(
ALL(data),
[rank_modelA] <= rankCurrent
)
)
You can see in the 'modelA_pivot' tab the 'addressCount_postcodeCumulative_modelA' column
doesn't work or make sense. As it includes the cumulative total of ALL addresses (including the 3,000 addresses that are excluded from the pivot)
Can anyone help me with a 'Measure' formula that sums only the addresses of the postcodes that are visible and included in the pivot table
FYI and in case anyone is wondering, why a 'Measure'; I am using excel Power Query and Power Pivot so if/when the data upstream changes, the data team will be able to refresh this worksheet with a single click (more or less), and the campaign manager still gets to use excel (the tool they know and like)
But, the use of excel Power Query and Power Pivot and setting this up as an excel Data Model (which uses OLAP structured data)
is also injecting constraints which I'm hoping to fit the answer to this puzzle inside
Constraints such as;
I can't seem to put calculated fields onto the pivot table, and
I don't want to just add conventional excel columns on the side of the pivot table as the size of the pivot table is dynamic depending on choices of the Campaign Manager (like their choice of threshold # addresses in the slicer)

Excel data tables: Multiple outputs with only one input column

I am trying to create a data table with multiple outputs across periods, but for the same scenarios.
Is it possible to create that without inserting an extra column between each output column to deliver input for the data table (i.e. input column = index 50-110).
Is this in any way possible? See picture of what I would usually mark to create the data table (this does only cover one period/output though). But if I were to make the scenario for FY23, then I would need to insert a column between FY22 and FY23 where I copy the index 50-110 again. I would like to not have to do that.

Power Query: how can I make power query tolerate columns with the same name?

I have a table with several column having the same name.
This columns is updated and provided regularly to power bi.
The columns has several columns with the same name such as "Result", "Result" and do so on...
However, Power BI adds each time in an automated way a number after my columns.
When I try to "force" power bi not to have a number, I get the following message
"The name "Result" is already used for a column..."
How could I change this?
The only way would be for the people using my file to extract the data and correct the name manually in excel...which is not great
You cannot edit this behavior, PowerBI needs an unique identifier to reference the data, therefore the column name must be unique within a table (the complete identifier is given by table + column), otherwise the tool won't be able to reference the data.
This rule usually applies to any tool that manages data and sometimes to the data themselves (that's up to the format though). How can the tool get data from "Result" if more than one column has this identifier? which is the right one? The tool does not know and based on the context can give you an error or will fix this issue itself by making the names unique.
Note that also excel will append numbers to the columns (with the same name names) if you put the data in a proper table (insert-> table), in fact, an excel sheet can be considered unstructured free data, meanwhile, an excel table will enforce the data structure.
Most tools (like PowerBI) will also enforce data types.

How to get value from nested relations in Power Pivot?

I'm using Power Pivot add-in to create a data warehouse for generate dynamic tables and graphs (strictly data source is Excel), but I have a problem whit a calculate in the relations. My data model is the following:
My Snowflake data warehouse model
So for the fact table "fSales" I need to multiply the dCostDetail[Value] per dWorkCost[Value] to generate the fSales[Expenses] amount.
I tried to use the formula but I get an error: related but it don't allow to nested between the relations, e.g. fSales[Expenses] = related(dCostDetail[Value])*related(dWorkCost[Value])
Also I tried to use the next formula:
fSales[Expenses] = related(dWorkCost[Value]) * Calculate(Calculate(Calculate(Value(dCostDetail[Value]), Userelationship(fSales[IdProduct],dProduct[Sku]),Userelationships(dProduct[IdCateg],dCategory[IdCategory]), Userelationships(dCategory[IdCategory],dCostDetail[IdCateg]))))
And I need this "type" of normalized model to have the details when I analyze the information, e.g. filter, but if you know another way to generate the calculation it would be ok.
RELATED doesn't work in measures, because it evaluates on a record-by-record level. So you're on the right track, but what you need to do is create a column in Powerpivot in the fSales table called "Cost Detail" or whatever, and use a RELATED formula there to pull in that value from the CostDetail table. Create another column and do the same thing to pull in the dWorkCost value into the fSales table.
Then you can do a measure for the expenses like this:
Expenses:=SUM([whatever you called CostDetailColumn])*SUM([whatever you called WorkCostColumn])
You should be able to drop that measure into a pivot and it should do what you're looking for.

Excel Data Model - Creating a many-to-one summary table by mapping table and column names

I am trying to create a summary calculation on a set of tables which I have added to an Excel data model. I have 5 tables with the following columns:
Datetime (UTC)
Measured Data 1
Simulated Data 1
Measured Data 2
Simulated Data 2
etc.
I have created a master Date-time table which links these 5 tables together on their UTC date-time column.
My query is how to optimally create calculated fields on each of these tables without needing to explicitly specify the calculations on each individual table, as is the case with PivotTables (I need to select the specific measured and simulated data columns from one individual table in the data model). Instead I would like to be able to map all measured fields to one column and all simulated fields to another, and then use filters to select out the fields (or groups of fields) I want to compare.
I started by creating a summary table which lists all my tables in my data model by name along with the names of measured and simulated columns within each. However, I'm unsure what the next step should be. This seems like a pretty straightforward problem, but it has me stumped this morning. I'd appreciate any help. Let me know if I haven't fully explained anything.

Resources