DIVIDE using totals in Power BI – Cost per FTE - powerbi

I have two columns of data, FTE REGION TOTAL AMOUNT and FTE REGION TOTAL FTE.
I want to calculate the cost per FTE by Region (by dividing the sum of the ActualExpensebyRegion column by the ActualFTEbyRegion column).
My divide formula below is not working
costperfte = DIVIDE(fteregiontotal[AMOUNT],fteregiontotal[FTE])
I know that Power BI will calculate the sum of each column, but how do I perform a calculation using those sums and divide by region.
Expected Outcome
Region Cost per FTE
------------------------------------
EMEA 7,049
APAC 2,178
LATAM 403,380
CAM 1,190
NALA 23,797

Create this measure:
Cost Per FTE by Region :=
VAR Numerator = SUM('fteregiontotal'[Amount])
VAR Denominator = SUM('fteregiontotal'[FTE])
RETURN
CALCULATE(DIVIDE(Numerator , Denominator ))
And use it in a matrix or table with your [Region] in the "Rows" field and the measure in the "Values" field.

Related

How do I create a quarter-over-quarter variance column or measure with a table of account balance totals by quarter?

I have a table that lists quarter-end account balances by account and business group and I'd like to create a measure or column that shows the quarter-over-quarter balance change for each company/account combo (e.g., Group A, Account 10000 quarter-over-quarter change is $500).
I've tried various formulas using the calculate function, but these don't work if I don't apply aggregation (SUM and SUMX are what I've tried) to the AMOUNT column. The aggregations seem to mess up the results. I either get blank values or duplicate amount values. I think it's because the amounts don't need to be aggregated. They're already aggregated values.
How can I do a simple subtraction based on quarterly dates without having to aggregate my amount column?
The formula(and similar variations) I've tried:
QtrChange =
VAR CurrentAmt = TABLE1[AMOUNT]
VAR PrevAmt = CALCULATE(SUM(TABLE1[AMOUNT]), PREVIOUSQUARTER(TABLE1[DATE].[DATE])
RETURN = CurrentAmt - PrevAmt
Table example:
Business Group
Account
Quarter end balance
Quarter
A
100000
$2000
3/31/22
A
200000
$3000
3/31/22
B
100000
$4000
3/31/22
B
200000
$5000
3/31/22
Edit:
Edited DAX formula with labels tying to example table, for better clarity:
QtrChange =
VAR CurrentAmt = TABLE1[Quarter end balance]
VAR PrevAmt = CALCULATE(SUM(TABLE1[Quarter end balance]), PREVIOUSQUARTER(TABLE1[Quarter].[DATE])
RETURN = CurrentAmt - PrevAmt

How to have the table total the sum of my measure which has an IF condition

I'm creating a table that automatically calculates the bonus for each salesperson based off their sales figures. I'm struggling with the measure
Whale Accounts =
IF('Oct-Dec Refresh 1.5.23'[YearOverYear Variance] >
800000 && 'Oct-Dec Refresh 1.5.23'[Percentage Difference] >= 1.1, 2500, 0)
Any account that sold over $800,000 and had a sales growth increase of 10%, receives $2500 in bonuses. I created the measure and it shows $2,500 for each account that meets this criteria, but the table doesn't sum it, how can I get the table to sum the total?
Also, both YearOverYear Variance and Percentage Difference are measures. I have attached an image for clarification
I tried creating custom columns, using SUM, CALCULATE but I haven't been able to figure it out.
You need a summing iterator over your accounts for this. Something along the lines of:
Bonus =
SUMX (
VALUES ( 'Table'[Master Bill To] ) ,
[Whale Accounts]
)
Where the account column is the one you are using in the visualization!

Correct total for measure evaluate all rows

I am trying to use a measure to find the total impact of a price change.
Currently, I have a table with the date, region, product quantity, and revenue.
I have measures that return YTD and PY YTD for both revenue and product quantity.
AvePriceYTD = Rev YTD/ Q YTD and AvePricePYYTD = RevPYYTD/Q_PYYTD
My final measure is PE = (AvePriceYTD-AvePricePYYTD)*Q_PY
When totaling the AvePriceYTD-AvePricePYYTD is correct but when multiplying Q_PY it gives a different result to the sum of the individual PE for each region.
I know that this involves the HasOneFilter to choose the total but not sure how to evaluate each region individually and then total. It is not possible to evaluate each row as this is monthly data and there are multiple rows per region.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
This link explains the answer, I initially didn't realize that the _table and _value were actually mean to be typed and not replaced with your own text.

How can I measure Number of Items with over X amount of sales?

I have a Power BI database set up as follows:
Sales[Date] is the date in which the sale took place. Sales[ProductID] is the SKU, while Sales[Units] is the number of units sold per SKU. I have also added a measure to calculate the total # of units sold. I am trying to set up a distinct count of SKUs where more than 500 SKUs were sold. I am using the following formula:
SKUsWith500Sales = CALCULATE(DISTINCTCOUNT(Sales[ProductID]),FILTER(Sales,[TotalUnits]>=500))
The output is either blank or inaccurate.
Thank you!

Power BI - Table Visualization Totals Row

I have created the following table as a vizualization in Power BI.
The blue columns are measures I created. I need the totals for those columns to equal the sum of the visible values on in the table. Do I need to create the variances as calculated columns instead of measures?
The desired result would be for the Unit Variance column to total $3.87 and the Total Variance column to total $923.76.
Unit Variance is being calculated as follows
average('Sent'[SentAmount]) - average(Received[Received Amount])
Total Variance is being calculated as follows
[Unit Variance] * sum('Sent'[Sent Volume])
Here is the answer I came up with
I left the unit variance as a measure
unit variance = average('Sent'[SentAmount]) - average(Received[Received Amount])
But I made the total variance a column
Total Variance = ((SUMX(Filter('Sent','Sent'[Sent Volume] = 1),'Sent'[Sent Volume])) / sum('Sent'[Sent Volume])) * [Unit Variance]
I have a column in my sent table that puts a "1" in the row to count volume.