This trick is best taught by first having your dog sit in a corner of the room with you standing in front of him. This allows the corner to support your dog and keep him from falling over.
Using food, hold it above your dog and entice him to reach up and take it. Progress slowly, each time encouraging the dog to rise higher.
Make sure your dog keeps his haunches on the ground. Use the treat to encourage the dog to shift his weight back over his haunches—it will help him keep his balance.
Once your dog is balancing well in the corner, slowly move your dog outward and attempt the trick. Expect some regression when the dog loses the support of the walls and move slowly until the dog perfects it.