Filters based on totals

Hello,

I have the following simple Sales and Categories tables:

Which are linked by the SKU_nb as follows:
image

I would like to select the SKUs that have total sales amounts greater than 5000, which are SKU number 110 and 150.
image

I have a measure that sums up the Amount column.

The way I found was to put my measure in the Categories as follows, named Sales by SKU:
image

And then to write the following measure:

=CALCULATE([Total sales];‘Catégories’;‘Catégories’[Sales by SKU]>5000).

It works fine and I get what I want:
image

My question is the following: is there a smarter way to do it without including the measure back in the Categories table?

Thanks for anyone who can help!

Pascal

1 Like

it depends on what exactly you are trying to accomplish. If the only goal is to filter one or two visuals to this level, then I recommend applying a filter to the visual itself using the filter pane.

In this screenshot, I have added a filter to the “Filtered” visual, there is no filter on the “Unfiltered” visual.

NOTE: even If you are going to hide the visual pane for the end user, you can use it to filter the visuals for your own purposes.

Another option is to create a measure that only shows sales that are over a certain total - I like to do this by branching my measures, so in this case I have two different measures:

  • Sales = SUM ( Sales[Line Total] )
  • Filtered Measure = IF( [Sales] > 40000000, [Sales], BLANK() )

image

NOTE: the measure solution requires an additional trick to ‘fix’ the total - because the total is over my limit, so it will show with the example above.

If you need to use the number as a filter amount for the USER to select, then you may want to use a calculated column (which I think is what you are describing above - without seeing your model it’s hard to tell).

Sample file is attached with examples of what I’ve shown here.
eDNA - filtering visual to only lines with a particular total.pbix (363.8 KB)

1 Like

Hello Heather, thank you very much for your quick reply! I had actually not thought of the filter solution in the visual.
Best Regards
Pascal

1 Like

Happy to help - I know that the visual filter trick has saved my bacon a couple of times in the past :slight_smile: