The Past Perfect Progressive is used:
before another action in the past.
"He had been living in Seattle for 15 years when he"
moved to Portland."
at a later point of time in the past.
"They were tired because they had been cleaning the house"
all day."