I cant think this one through, any help would be appreciated. I have a measure of the count of number of sales (distinct count of transaction numbers). Now what I'm looking for is the average number of lines per order.
How can I calculate that in Analysis Server 2008 R2?
Related
London City number Data
Population of London city numbers is 100,000. How can I calculate the normalized data using population? I have searched and spent a lot of time to find out any clue but failed. I find ways to normalize data without using population number but did not find any way to normalize the data using population number. Can anyone help me, please?
I've got this table I've defined in PowerBI:
I'd like to define a new table which has the percentage of medals won by USA from the total of medals that were given that year for each sport.
An example:
Year Sport Percentage
1986 Aquatics 0.0%
How could I do it?
You can use SUMMARIZE() to calculate a new table:
NewTable =
SUMMARIZE(
yourDataTable;
[Year];
[Sports];
"Pct";
DIVIDE(
CALCULATE(
COUNTROWS(yourDataTable);
yourDataTable[Nat] = "USA"
);
CALCULATE(
COUNTROWS(yourDataTable);
ALLEXCEPT(
yourDataTable;
yourDataTable[Year];
yourDataTable[Sports]
)
);
0
)
I know that an answer has already been accepted, but I feel that I should provide my suggested solution to utilize all of Power BI's capabilities.
By creating a calculated table, you are limited in what you can do with the data, in that it is hard coded to be filtered to USA and is only based on Year and Sport. While that is the current requirements, what if they change? Then you have to recode your table or make another one.
My suggestion is to use measures to accomplish this task, and here's how...
First, here is my set of sample data.
With that data, I created a simple measure that count the rows to get the count of medals.
Medal Count = COUNTROWS(Olympics)
Throwing together a basic matrix with that measure we can see the data like this.
A second measure can then be created to get a percentage for a specific country.
Country Medal Percentage = DIVIDE([Medal Count], CALCULATE([Medal Count], ALL(Olympics[Country])), BLANK())
Adding that measure to the matrix we can start to see our percentages.
From that matrix, we can see that USA won 25% of all medals in 2000. And their 2 medals in Sport B made up 33.33% of all medals that year.
With this you can utilize slicers and the layout of the matrix to get the desired percentage. Here's a small example with a country and year slicer that shows the same numbers.
From here you are able to cut the data by any sport or year and see the percentage of any selected country (or countries).
For a certain data range, for a specific dimension, I need to calculate the average value of a daily rank based on the average value.
First of all this is the starting point:
This is quite simple and for each day and category I get the AVG(value) and the Ranke based on that AVG(Value) computed using Category.
Now what I need is "just" a table with one row for each Category with the average value of that rank for the overall period.
Something like this:
Category Global Rank
A (blue) 1,6 (1+3+1+1+1+3)/6
B (orange) 2,3 (3+2+3+2+2+2)/6
C (red) 2,0 (2+1+2+3+3+1)/6
I tried using the LOD but it's not possble using rank table calculation inside them so I'm wondering if I'm missing anything or if it's even possible in Tableau.
Please find attached the twbx with the raw data here:
Any Help would be appreciated.
I know that we can use inbuild function “Moving Average” to calculate rolling average with specific intervals like 3 months, 12 months, etc.. Is it possible to divide two moving average values to get the “Per system value”.
For example:
Moving average 1: Total number of Hrs
Moving average 2: Total number of systems
Per System = Total number of Hrs/ Total number of systems
Appreciate your help and suggestions.
Found a solution.
Create a simple calculated column using "OVER" & "Intersect" function to calculate the Moving Average .
For example: SUM([Total number of Hrs) OVER (Intersect(LastPeriods(12,[Yr_Mn]),[XXX])) / 12"
Also use the same logic to calculate moving average for Total number of systems.
In the visualization, using "First" function, exclude the duplicates.
For example:
First([Total number of Hrs]) / First([Total number of systems] as [Per System Value]
I've spent a lot of time searching for a solution but not successfully. For that reason I decided to post my problem or question here hoping somebody of you can help me.
I want to find out which variables are influencing the travel distance of two animals (same species).
The response variable is distance moved (in meters). In total I have 66 tracking sessions for both animals.
The independent variables are: temperature, rainfall, offspring (yes = 1, no = 0), observation period (in minutes) and activity.
I looked at the animals (one day - one animal) every 15 minutes and noted the state of activity (active = 1 or inactive = 0). For that reason my data table consists around 1800 points and the same amount of activity records.
Then I created a table with following columns:
Animal, Tracking-Session, rainfall, offspring, observation period, active, inactive, distance
The two columns active and inactive contain the sum of active (inactive) records per tracking session.
For example in tracking-session 1 the animal A was 30 times active and 11 inactive and moved 6000 meters during that tracking session.
I thought I could do my analysis with this table using the command cbind() to make one column for activity out of the two columns with "inactive" and "active". But this does not work, I get:
Error in lme4::lFormula(formula = distance~ (1 | animal) + activity + offspring + ...
rank of X = 12 < ncol(X) = 13
I want to include the second animal as a random factor to get an output valid for the whole "population" (which only consits of two animals in that case).
How can I fit a linear mixed model to this data or the first question is: how my data table has to look like to do such analysis?
I started running a linear mixed model with my original data table consisting of 1800 rows but the outcome was not convincing. And I don't know if this table was built up correctly for this task. Because I have only 60 tracking sessions and for that reason only 60 resulting travel distances, but 1800 records of activity (each 15 minutes - active or inactive). I don't know how to handle this situation the only possibility for me to overcome this problem was to copy the travel distace (which is the result of all points watched per day) and assign it to each single point of that tracking session.
The same is for rainfall and temperature because these conditions were only measured once a day I had to copy the value for each single point taken on the same day.
Is this correct or better can R handle such tables (like in the picture)? Or is it better to create a table with one row for each day (as I describe above)?
If the the second table (the one with one row per tracking session) is the better choice, how has it be transformed that R can use it?
Hopefully you can follow my explanations (I tried to explain it as detailed as possible) and anyone can help me!
Thanks in advance!
Iris