Percent Of Total in Quicksight - percentage

percentOfTotal(
sum(resubscriberNumber), [count(customerid)]
)
I want this to compute on a column level and not on the row level.
It is computing on the row level. Lets' say I want %of subscribers of total users. How can I achieve this?
If I do it in the simplest way to create a calculated field (subscribers/total users) * 100. Quicksight is giving an error.

Related

How to create a function for each filtered interval in data frame?

I have a data frame that contains a column of total ads shown to a consumer, and also a binary column that shows whether they bought the product or not.
I want to calculate the conversion rate (# of People bought/# People in Group) after grouping the consumers based on the number of ads they have seen (e.g. Group 1: 0-9 ads, Group 2: 10-19 ads etc. all the way until say 300).
Is there a way to do this other than manually calculating by group (i.e doing 30 of the same calculation)? Perhaps with some sort of looping function?

Tableau Weighted Average Per Capita Calc not aggregating right

I am trying to create a simple revenue per person calc that works with different filters within the data. I have it working for a single record, however, it breaks and aggregates incorrectly with multiple records.
The formula I have now is simply Sum([Revenue]) / Sum([Attendance]). This works when I only have a single event selected. However, as soon as I select multiple shows it aggregates and doesn't do the weighted avg.
I'm making some assumptions here, but hopefully this will help you out. I've created an .xlsx file with the following data:
Event Revenue Attendance
Event 1 63761 6685
Event 2 24065 3613
Event 3 69325 4635
Event 4 41996 5414
Inside Tableu I've created the calculated column for Rev Per Person.
Finally, in the Analysis dropdown I've enabled Show Column Grand Totals. This gives me the following:
Simple Fix
The problem is that all of the column totals are being calculated using the SUM aggregation. This is the desired behavior for Revenue and Attendance, but for Rev Per Person, you want to display the average.
In Analysis/ Totals / Total All Using you can configure the default aggregation. Here we don't want to set all of them though; but it's useful to know. Leave that where it is, and instead click on the Rev Per Person Grand Total value and change it from 'Automatic' to 'Average'.
Now you'll see a number much closer to the expected.
But it's not exactly what you expect. The average of all the Rev Per Person values gives us $9.73; but if you take the total Revenue / total Attendance you'd expect a value of $9.79.
Slight More Involved Fix
First - undo the simple fix. We'll keep all of the totals at 'Default'. Instead, we'll modify the Rev Per Person calculation.
IF Size() > 1 THEN
// Grand Total
SUM([Revenue]/[Attendance])
ELSE
// Regular View
SUM([Revenue])/SUM([Attendance])
END
Size() is being used to determine if the calculation is being done for an individual cell or not.
More information on Size() and similar functions can be found on Tableau's website here - https://onlinehelp.tableau.com/current/pro/desktop/en-us/functions_functions_tablecalculation.html
Now I see the expected value of $9.79.

Calculate Multiple Correlation Between Several Products

I Want to get the correlation between several Items which regarding to the historical Orders and sales and i want to do that to create a recommendation model for every new order (recommend the products depending on the correlation between the selected product and others) , So that i have an Idea to get this correlation by Create a query which pivoting my data to get every Order with the total of quantity of its items and then calculate the correlation between item.
I Already Attached an Excel Sheet Has a sample data for my case.
enter link description here.
"the numbers in the columns of products is the total of the quantity in every order for every product >> As Example the order of 131245 was has 1.96 of the product 11 and 3.91 of 27 and so on" i want to get the correlation between all products > the correlation depends on the orders and the items in it.
Is this Idea is Useful to get the correlation or i should use different value to calculate it ?
Any One have an idea about that ?
It is up to you to think what the correlation must be. If product A and B are always brought together, then the correlation would be 1. But what do you want to do if sometimes only product A is bought and sometimes both A and B? There is not one good code for this problem

Dax for % of columntotal

I've got a tablereport with on the rows product category and on the columns years. In the valuesection, I want to show the number of sales. This works fine. But now I also want to show the % of columntotal for the product categories.
I use dax:
Measure := count(factSales[salesnr])/calculate(count(factSales[salesnr]);all(factSales))
But this yields the percentage of grand total over all years. I want the percentage of columntotal for every seperate year.
The ALL(Table) function tells Power Pivot to ignore any filters applied over the whole table. Therefore, you're telling Power Pivot to count all the rows of the factsales table regarless of the Category or Year being filtered on the pivot table.
However, in your case, what you want is the sum for ALL the categories on each year. Since you want the sum of ALL the categories you must use `ALL(factsales[categories]). In this way, you're ignoring only the filters for the categories and not the filters for the years.
Based on the previous explanation the dax formula would be:
Measure :=
count(factSales[salesnr]) / calculate(count(factSales[salesnr]);all(factsales[categories]))

Get share of dimension member in calculated measure

Not sure if what I'm trying to do is possible or if I need to change my data model.
I have a dimension containing the different amouts a customer can loan so what I wan't to do is see the share of a certain amount compared to total sales.
Pseudo code:
member [Measures].[Share 5000] as 'count([Amount].[5000])/([Measures].[Total Sales], [Time].CurrentMember)'
I assume you want the 5000 included included in your calculation? So if 10 consumers loaned 5000 and the total sales is 100000 the share is (5000*10) / 100000 = 0,5
First you will need a 'number of customers' measure, I don't know if it exists already in your data model otherwise you will have to add it.
Then you can write your calculation something like this:
member [Measures].[Share 5000] as
'
(([Amount].[Total Amount].[5000],[Measures].[Number of Customers])*5000) /
([Amount].[Total Amount],[Measures].[Total Sales])
'
You don't need to include the Time.CurrentMember in your calculation as it does not make any difference in this case. If you put Time in the rows or columns it will be automatically included.

Resources