I have a dataset of Facebook posts with count of engagements and total reach for each post, for a list of markets and dates.
As part of the work I have defined engagement rate as a calculated field = SUM(engagements)/SUM(reach).
Now I want to produce a table showing for each market what is the difference in engagement rate respect to the average engagement rate of all the markets in the view (as a benchmark).
I have tried to use Fixed LOD expressions to achieve this, but I cannot make it work. The fixed value across all markets included in the filter does not correspond to the average of all the markets in the view. It's not even the sum of the market engagement rates, it's a number that I have no idea where is coming from.
To test the Fixed LOD expressions I tried using it with the row engagements metric (as well as reach and Number of Records) and the Fixed LOD expressions returns the sum of the engagements for all markets, as expected.
I'm not sure how to get the average of the markets average engagement rates. Unfortunately I cannot share the data as it is client sensitive.
This is the test LOD that works as expected:
{FIXED [Emea+Emea_Importers], [Platform], [Categories EMEA Brief], [Date in range]: SUM([Engagements])}
while this one is the one that I need, but that unfortunately doesn't work:
{FIXED [Emea+Emea_Importers], [Platform], [Categories EMEA Brief], [Date in range]: SUM([Engagements])/SUM([Reach])}
I have also tried the below, based on this answer
{FIXED : AVG( {FIXED [Emea+Emea_Importers], [Platform], [Categories EMEA Brief], [Date in range]: SUM([Engagements])/SUM([Reach])})}
but again the result is not correct.
If anyone can help that would be great.
What you are going to want to do is create an engagement rate calculation for each market like:
SUM({ INCLUDE [MarketName]: SUM(Engagement) / SUM(Reach) })
To get the get the overall average you can use a LOD such as:
SUM({ EXCLUDE MarketName: SUM(Engagement) / SUM(Reach) })
Then you should be able to create separate calculations for the difference, like:
[Engagement Rate - Market Excluded] - [Engagement Rate - Market Included]
Your table will end up looking like this:
I used the Sample SuperStore data for the example above.
Hope this helps!
Related
I'm facing an issue in QlikSense, trying to compute some statistical indicators (Percentiles, Quartiles, StdDev, Median etc.) on a dataset which is already grouped by the source.
I mean that my dataset is something similar to the following, in which I have for each combination of Week and Customer Age the total number of purchases:
I want to show the median of Customer Age, and due to the structure of the dataset I can't use fractile or median built-in functions, since they would come out with something different.
Let's suppose I want to calculate the median age of people for all the 3 weeks, so that I want to know what's the age of people who have done the 50% of my purchases.
To let you better understand the question, I show you the histogram:
In this case, the median I want to get is 24-26 years, since the 50% of the total population falls under that range.
I found a useful reference here, but I am having troubles in writing this formula in QlikSense
https://mba-lectures.com/statistics/descriptive-statistics/603/relationship-between-quartiles-decile...
Thanks a lot in advance.
[EDIT]: This is my Data Model View:
[EDIT 2]: Here is my qvf with a dataset more similar to the original one I'm using. As you can see, I can't get the correct result using your formula. In addition, I would like to use it in order to plot the trend of the median through weeks, but it doesn't seem to be possible (Even if I use the modified version of the formula I pointed out in the comments).
If you want to calculate median in such a scenario you need to weighted median and basically check which dimension value is in the middle:
Aggr(
If(
(Rangesum(
Above([# Purchases],0,RowNo())
)
/Sum(TOTAL [# Purchases]))>=0.5
and
(Rangesum(
Above([# Purchases],1,RowNo()-1))
/Sum(TOTAL [# Purchases]))<0.5
,[Customer Age])
,[Customer Age])
Pretty new to Stack overflow but hoping to get an answer to one of my project work
Region Sales Sales (LOD calculation only)
West 100 0
East 50 -50
North 200 100
What would the LOD calculation be to get 0,-50 and 100 in column Sales (LOD calculation only)?
I do understand that row 2 and row 3 are both subtracted from first row. It's easy to do with Table calculation but i am unable to figure the LOD part out
Welcome to Stack Overflow, i am also very new so hope i am helpful.
Looking at your requirement, i believe a LOD expression would not be valid for this. As you have mentioned you are already able to get your results using table calculations, which is the right approach for this type of problem.
LOD expressions are used when you need to do some aggregation in your data which is at a different grain then the selected dimensions.
Hope this helps.
To get sales like the one you displayed, to embed an if statement in an LOD calculation and subtract the initial sales from that number. You could write it as one big calc, but I'll break it down for simplicity.
You'll need a way to assign the amount for the western region to every row.
That calculation is
{EXCLUDE[Region]:SUM(IF [Region]='West' THEN [Amount] END)}
Then you subtract the initial sales with a field like this
SUM([Sales])-SUM({EXCLUDE[Region]:SUM(IF [Region]='West' THEN [Amount] END)})
I am calculating efficiency for mechanics using the sum of hours worked divided by the sum of hours we charged the customer as per work order. Using tableau's total from the analytics pane, it gives me the weighted average of their efficiency (whereas the average function is skewed as it only takes into account the final efficiency rating.
When I use index() or rank() to create a filter to remove individual work orders, the total doesn't change.
How can I remove work orders and change the total without having to use a filter that selects individual work orders?
You could try using LOD with specific condition in the if statement before you take the average or do any calculation.
Since the fixed calculation will take the data directly from the table. The number will only changed with filter when you put the parameter in the first part of LOD.
A quick example:
{Fixed [parameter]: AVG(IF [work orders] == condition then [weighted average] END)}
I have a dataset that contains various wait-time metrics for all appointments in a practice for a year (check-in to call-back, call-back to check-out, etc). It contains appt time (one of about 40 15 minute slots), provider, various wait times.
I can get Tableau to show me, for each 15 minute slot, the average wait times for each provider in the practice.
What I can't seem to be able to do is also display the overall average for the practice for that given time slot so as to be able to compare that provider vs. the "office standard".
I'm super new to trying out Tableau, so I am sure it is something very simple.
Thanks in advance.
Use a level-of-detail (LOD) calculated field. An LOD calculation occurs at whatever aggregation level you specify, rather than what's on the row or column shelf.
You didn't provide any info about your data set so I will use made up names here.
This gives you the overall average wait time, regardless of other dimensions on row/column shelves:
{FIXED : avg([wait time])}
This gives you the overall average wait time per provider, regardless of other dimensions on row/column shelves:
{FIXED [Provider Name] : avg([wait time])}
See the online Tableau help at https://onlinehelp.tableau.com/current/pro/desktop/en-us/calculations_calculatedfields_lod_overview.html for more information. If you have filtering and need to calculate the overall without filters applied, look at the INCLUDE LOD keyword.
I am a very basic user of tableau and I have not found an answer to my question.
I have a txt file that has historical daily data for 98% of all the stocks in the US, with their daily capitalization. Each stocks has its TICKER, Daily Market Value for every trading day of the year, and its SECTOR.
I did a simple time series that display SUM([Mktval]) (sum of all individual market values) across all stocks, on a daily daily, and where I can see that the total value as of 2016 is about 24 Trillion USD, as in the image below.
When I change the view column from DAY to YEAR, I don't see the right values, but something a lot larger. So I realized that I need to do SUM([Mktval])/252 to get the right value for a year (there are 252 trading days in a year).
If I change the view to MONTH, as in the chart below, the numbers are again wrong because 252 is not the right value to use in the division.
Is there any way that Tableau can adjust the values automatically to reflect the AVG MktVal across different time intervals?
Thanks
Replace SUM(Mktval) on the Rows shelf with the following calculated field
avg({ fixed day(Date1) : sum(Mktval) })
That solution is all in one step. It is perhaps a bit more clear to use 2 steps. First, create a calculated field called total_daily_market_value defined as
{ fixed day(Date1) : sum(Mktval) }
Then make sure that calculated field is a measure. It is an LOD calculation that you can think of as a separate table with one value for each day showing the total market value for that day.
Drag that measure to a shelf, and then change the aggregation function to AVG(), MEDIAN(), MIN(), MAX() or STDEV() as desired. Tableau will aggregate the total_daily_market_value using your chosen aggregation function for whatever values of Date1 are in your view.