Amaziah did what was right in the eyes of the Lord, but not as his forefather David, but as his father Joash. Here are two comments about that:
1. David has committed some very great sins, and we do not read that Joash and his son Amaziah have done similar things; nevertheless, David is the shining example. The reason for this is that David’s heart was always turned to the Lord. In the end, David always sought his salvation and refuge with the Lord, even at his lowest. That was different with Joash and his son Amaziah: they deviated less from the straight path than David did but did not correct it by turning back to the Lord with all their heart (which David did).
2. Of Joash, it is known that, as he became older, he became less and less faithful in the service to the Lord (see 2 Chronicles 24:17–22). That was partly due to Joash being initially influenced by Jehoiada, the high priest, but he lost that positive influence when Jehoiada died. It is certainly not impossible that something similar also happened with Amaziah: as long as his mother Jehoaddin lived, Amaziah stayed more on the path of the Lord, but that became less after his mother had died.
This consideration is (among others) based on the literal translation of 2 Kings 14:3b: He did in all things as Joash his father had done.
This indicates there were telling parallels in the life of father and son.
3 And he did what was right in the eyes of the LORD, yet not like David his father. He did in all things as Joash his father had done.