Cambridge Analytica LLC enjoyed good results for 2016, when it worked for the campaign that helped to elect President Donald Trump, but its business declined sharply in the next year as questions mounted about its tactics.

Revenue at the data-mining company was only about $5 million in 2017, after topping $25 million a year earlier, according to new bankruptcy-court records.

Cambridge—facing...