1
votes

I’m wondering if there is a way, in a table, to calculate the percentage over a grand total. I think this is a fairly simple issue, but I really can't wrap my head around it.

I have a table with a count, divided into different Categories:

Table

I also have several slicers:

Slicers

What I would like the table to show is the percentage of the current selection over the grand total, while keeping at least other two filters set (the Year(Anno) and another one set on the entire page).

If I select in the slicer “Range Scostamento %” a value, the table will obviously update the numbers:

Filtered values

The value I’m looking for is the “weight” in percentage of the filtered values over the total value. So for example, for the first row I will have 317/14.793 = 0,0214 = 2,14% and so on.

I think my question has something to do with the SELECTEDVALUE/ALLSELECTED, maybe KEEPFILTERS, but I really don’t know how to make it work.

Thanks in advance!

Alessia

1

1 Answers

0
votes

If I understand your requirement correct, you need these below measures for your purpose-

contratti = count(table_name[column_name])
grand_total = 
CALCULATE(
    count(table_name[column_name]),
    ALL(table_name)
    //-- ALL will return count of entire table
    //-- you can use ALLSELECTED if you wants the 
    //-- grand_total for filtered data based on slicer
)
percentage = [contratti] / [grand_total]