I'm having issues creating a measure which calculates the total average.
I have a total teams column (team a, team b, team c) and a goals scored column ( 1, 3, 2)...
I created a measure which computes the total goals scored (by date) of the selected team (selected via a filter), and I need to compare that against the total average goals scored (by date).
Measure for total goals
= CALCULATE([TotalGoalScored],ALLSELECTED(Teams[Teams]))
and the subsequent
AverageGoals Scored = AVERAGEX('Teams',[TotalGoalScored])
However, when I drag both of these values to a viz, and select a "team" both values are the same, (i.e. it is computing the average goals scored for only the selected team which = total goals scored). When I select "All" teams, the average is being computed correctly. What alternate formula can I use to computer average?
So the problem is in the "AverageGoals Scored" measure, which shouldn't be affected by team filter?
If so, how about like this:
AverageGoals Scored = CALCULACE(AVERAGEX('Teams',[TotalGoalScored]), ALL(Teams[Teams]))
Related
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!
How can i find the average of each row?
I need to calculate the average of category 1 to 5 for Location A and B and C and so on.
Problem 2: I need to calculate the of all columns in row 10
I tried average, averagea and average but to no avail.
Option-1: You unpivot data and your category values will comes in row per category. Now you can easily calculate the average per location.
Option-2: do something very static like: (cat1+cat2+cat3+cat4+cat5)/5
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.
I'm trying to group the far right column based on the (top 5/ all the rest) of the rank column. I need a result where I can display a chart that shows the aggregated 'number of sales' for the (top 5/all the rest)
Here is an example:
I'm using RANKX to rank based on the 'Units sold', and using an if statement to segment into a yes/no.
How do I aggregate this further so I can find the total units sold for YES and total units sold for NO? I need to keep this in the pivottable. I'm thinking of adding a measure that can be used as a filter or aggregation but I can't add measures to filter. I just started with DAX and I might be missing something.
If you just need a straight list of items with a total at the bottom, you could do this:
assume the table is called 'data':
--
Calculated Columns:
isTop5 = if(rankx(all(data),data[units])<=5,1,0) -- top five gets a 1, everything else 0
--
Measures:
numTopFive:=sum([isTop5]) -- add up your top fives (maybe your population only had 4 lines?)
numNotTop5:=count([code])-[numTopFive] -- subtract number of top 5s from total population count
--
-However-
If you try to subgroup this (i.e. group your codes into regions), then the example I provided will not show five top-5s for each subgroup, it will only show the sum of top 5s if a particular code so happened to be in the top 5 of the entire population. hopefully that makes sense. If you need this using sub-grouping I can provide a different example.
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!