DAX debugging consists of identifying why a measure gives an unexpected result. Common methods: check the filter context, break the formula down with variables, display intermediate results in a test table, and run EVALUATE queries to inspect the tables being manipulated.
Example
EVALUATE ROW("Total", [CA], "Nb lignes", COUNTROWS(Ventes))