In each chapter there is a struggle for power. In 38, Onan does not want to fulfill his duties as Tamar's brother-in-law and provide her with offspring. Judah fails to fulfill his obligations, so Tamar resorts to tricking him into a sexual encounter where he is unaware of the identity of the woman with whom he sleeps! When he finds out of Tamar's pregnancy his response is disgusting: "let her be burned." Apparently he is above the law, but she is not. Thankfully she was clever and finally received that which she rightfully deserved: an offspring.
And then comes the struggle with Mrs. Potiphar. Day in and day out she begs Joseph to sleep with her, and day in and day out he refuses the temptation! Talk about a pillar of integrity and character! Joseph stands firmly against her and refuses to give in to her pleas. Finally, she sends the servants away so no one is around and grabs him, and Joseph flees! Wouldn't we all be better off if we were only to flee from temptation. Joseph didn't toy with it and question whether it might be a good idea after all; he fled! Then God promoted him to prison.
Arguably, Joseph is one of the most powerful men in Genesis, but he never sought out power. He never accomplished it by the means of the world (through sexuality or through trying to take hold of the political structure). No, Joseph's power came because he took the role of the servant. Whatever was asked of him, he did with integrity and to the best of his ability. Isn't that the same with Christ? He didn't try to manipulate the government or take over the religious scene; He didn't try to win His power through sexuality. He came, instead, as a suffering servant who gave His life for the ransom of all, and He was the most powerful person who ever walked the earth. We would be wise to follow in His footsteps.