Subtract rows which are grouped in power bI - powerbi-desktop

I am working on Power BI and have appended the data. Once appended i have grouped data between "R" (revenue) and "C" (cost). Now i want to reduce "R"-"C" in power BI. Can you help me

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)

Convert Excel query to Dax measure

Could you help me with DAX calculation for :
=IF(C11=0,"- ",(C21+C26)/C11)
CONDITION
,this is an excel calculation i want same calculation in DAX,Power BI
as per above image
The data isn't structured like a table in power bi. First structure your data into a normalized table format.
Which would your columns will be
Product category Amount
If you have a way to explain your logic that would help. If you write out your logic then maybe that would clarify what you need
To get the answer you want, you will need to do some filtered measures on based off of the product category once you normalize the data. I suggest adding it to power bi and giving it a shot

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

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.

DAX formula working in Power BI but not PowerPivot

I used the new quick measure feature in Power BI to create the below DAX formula. This is a running total based on a Period column that is in the format P01, P02, P03,...P12.
YTD =
CALCULATE(
SUM('Combined Data'[Period Value]),
FILTER(
ALLSELECTED('Combined Data'[Period]),
ISONORAFTER('Combined Data'[Period], MAX('Combined Data'[Period]), DESC)
)
)
This works perfectly in Power BI. I am trying to replicate this data model in PowerPivot so I can work on the same model in Excel. However the same DAX formula in PowerPivot returns an error that the MAX function can only be used on numeric data.
Data has been imported to the data model using Power Query with exactly the same script as in Power BI.
Why is the same DAX code not being treated in the same way in both programs?

Using Power Pivot when Columns are Dates

I have a very large data set that has 15,000 rows with a few descriptive columns and then the data itself is stored as monthly sales in 200 columns, one for each month. There are a couple of other data sets I need to connect this to so I want to be able to use Power Pivot to build the relationships.
How do I go about harnessing Power Pivot to build a dashboard for this data? Specifically is there a way to link all those date columns to a DimDate table so I can connect it to other data sets without reformatting the whole data set?

Resources