The past perfect continuous tense (also called the past perfect progressive) is the equivalent of the present perfect continuous for the past.
We use the past perfect continuous when we want to show that the activity began in the past and it has been going on for some time in relation to the moment of speaking in the past. It doesn't matter if the activity ended or resumed afterwards.
Yesterday I had a problem with my task. It was difficult to find the answer. I had been browsing websites for an hour when I finally found a solution. (= I had a problem, I started browsing, I spent an hour browsing, then I found a solution).
Nancy got a job last week. She had been looking for a job for the last two month. (= Two months ago Nancy started looking for a job. Last week she got one.)
At eleven o'clock we noticed that we had been playing that game for five hours. But we didn't stop and continued playing. (= It was eleven o'clock. Five hours ago we started playing the game. After 11 o'clock we continued to play.)
It had been raining since Monday. Then it was Thursday and it seemed like the rain wasn't going to stop. (= It started raining on Monday. It was still raining on Thursday.)
How to form the past perfect continuous
To form the past perfect continuous we use the auxiliary verb "had been" and the main verb with -ing ending:
had been + infinitive + -ing
|pronoun||auxiliary verb||infinitive + ing|
You can read more on how to form and how to use the past perfect in the related topics.