How to recalculate the percentages from total when filtering in Power BI? - filter

As I am not really sure how to express myself, I'll better demonstrate what I need to be done.
This is a sample DB.
You see here
that we have a category slicer and on the table is show the percentage of sales for a given product and its description.
On the next photo I used the slicer to filter the products on the "16GB" category. My task is when filtering, the total of the % to show 100% and the distinct products to show the percentage of this total (as part of the category, not of all other products and categories).
Thank you in advance!

You need to have a raw amount in your dataset. I was able to do this using this sample data.
Then for both table visuals in Power BI, you should select show value as percent of grand total for the amount value. This will allow Power BI to calculate the percentages dynamically as the filter criteria from the slicer changes.
Here is the result.

Related

Quicksight Pivot Subtotal Customization

I am creating a visualization in the pivot table in which I have used the average value of one column to be shown in the visualization. In subtotal and total for rows, they are not doing sum but rather taking the average value. For example, the 3 values in that column are 200,300,400 so in subtotal, they are showing 300 I want subtotal as 900. Can someone please help me in getting some solution for this?

AWS Quicksight - Top10 offices by REVENUE divided by REVENUE

Is there a way to make a metric in Quicksight that is the ratio between TOP10 offices by REVENUE divided by REVENUE.
Thanks
The problem is that if I apply a filter to select the TOP10 offices by revenue in the numerator, the same filter is the apply to the denominator.
It was not clear from your question exactly what you meant by "ratio between TOP10 offices by REVENUE divided by REVENUE" but I have assumed you wanted the TOP N real total revenue by Store alongside the "ratio" or percent of total revenue of ALL revenue, not just the TOP N stores revenue.
To do this you can use the following calculated fields.
Make a calculated filler field to 'partition' by; that is you can use it to make a single partition of the whole data set, e.g. "single_partition_filler":
ifelse(isNotNull(store),1,0)
Make the ratio calculation you want, "Revenue over Total Revenue". The trick here is to use the "PRE_FILTER" aggregation level in the Table calculations so you are getting the sum of revenue by store PRE_FILTER divided by the sum of revenue by all stores (using the filler column) PRE_FILTER:
sumOver(revenue,[store],PRE_FILTER) / sumOver(revenue, [{single_partition_filler}], PRE_FILTER)
Make a table with "Store","Revenue (Sum)" and "Revenue over Total Revenue (Min)" and using a TOP N Filter for Store by Revenue (Sum). See Quicksight example below:
Compare with the same table unfiltered below:
Dataset used:
store,revenue
A,100
B,50
C,40
D,70
E,60
A,35
C,80

How to create visualization using ratio of fields

I have a data set similar to the table below (simplified for brevity)
I need to calculate the total spend per conversion per team for every month, with ability to plot this as time based line chart being an additional nicety. The total spend is equal to the sum of Phone Expenditure, Travel allowance & Misc. Allowance, this can be a calculated field.
I cannot add a calculated field for the ratio, as for some sales person, the number of conversion can be 0 for a given month. So, averaging over team is not option. How can I go about this?
Thanks for help and suggestions in advance!
I've discussed the question with the Harish offline. I've learned that he is trying to calculate ratio per group, not per row.
To perform calculations per group, users can add calculated fields inside a QuickSight analysis and use level aware aggregation expressions. (Note that level aware aggregations can only be used in an analysis, not in the data prep view). Here is a link to the documentation about level aware aggregations if you want to learn more about this area https://docs.aws.amazon.com/quicksight/latest/user/level-aware-aggregations.html

Is it possible to order split series in Kibana histograms using the values of the split buckets?

Say I have an index of product sales where each document is an individual sale for a specific product. I can use Kibana to chart a date histogram of sales counts, bucketing by every month. This would be the frequency of product sales every month. Here is an example:
Sales per Month
I can also split that series using a terms aggregation on the product name, so I end up with the distribution of those sales across each product each month like so:
Sales across Products per Month
What I can't do, which seems straightforward, is sort that distribution by the product count in that specific month. I can sort it alphabetically, or by the overall sales of that product, but I can't do it using the sales during that month. This means that if the most popular product overall is at the bottom of the bar (like the green product in the above image), it remains at the bottom always even if the sales count of that product for a particular month is lower than everything else.
Is it possible to order this series by the product count in each month? In general, is there a way to order a split series by the value of each 'split'?

On Query Viewer, how to show percentages based on Row totals (not Column total)?

I have been using the Query object for some time and I can not find how to show the percentage of a value over the total of the row.
On this Genexus Query Usage Example, it shows totals by Continent, Country and Attraction.
How this query must be configured to show the attractions percentage over row totals to get a result like this:
Those numbers in the image you posted come from a QueryViewer example. They represent the total sales of Soy, Wheat and Rice per Continent and Country. There are three different measures in this query, and you cannot make calculations among measures in the QueryViewer, so you can't achieve what you want with these numbers.
But you can modify or make your query so that there is only one measure, let's say "Sales amount", and the Crop can be one dimension:
Dimensions: Continent, Country and Crop
Measures: Sales amount
Once the data is presented like this, the percentage will show exactly what you want.
PS: By "dimension" I mean attributes without aggregation and by "measure" I mean those attributes that have any aggregation function (Sum, Average, etc.)

Resources