Percentage of values containing one or more attributes

I have a very complicated task that I can’t quite understand how to resolve.

I have data such as :

Vehicle, Fault

I want to have a chart showing the number of vehicles with one or more faults. I want percentages and actual figures.

However, I also need to use a filter - so I can see how many vehicles there are that have engine faults. I can’t use a traditional filter because I wouldn’t be able to get the total amount of vehicles. It shows me as having 3 engine faults out of 3 vehicles.

My dataset is much more complicated than this, however, this is the crux of the issue I’m having. Can anybody advise?

So you want to filter to just see the cars that have engine faults, but you still want to see the percentage of these cars out of all cars, including ones without engine faults?

If so, I beleive you can utilize distinctCountOver() with PRE_FILTER to avoid filtering

in this case:

distinctCountOver({Vehicle}, [], PRE_FILTER)

would show 6 on a table for all vehicles (if you were to put vehicle and the DistinctCount calc field on a visual like a table) even if you filtered to only show engine faults.

You can then use this calculated field as a divisor to get the ratio for whatever group you are looking at, and multiply by 100 for a percentage.