To write a DAX measure that behaves correctly both inside and outside the visual filter context, use the ISINSCOPE() or HASONEVALUE() functions to detect the current filter granularity and adjust your logic accordingly. This allows you to return different calculations depending on whether a specific column (like Customer or Product) is in scope within a visual or not.
SalesAmountDynamic :=
IF (
ISINSCOPE(Customer[CustomerName]),
SUM(Sales[Amount]),
CALCULATE(SUM(Sales[Amount]), ALL(Customer))
)
This returns the sum per customer in visuals, but shows total sales (ignoring customer filters) outside those contexts.