Calculating the attenuation pi-element (attenuator) is not difficult, you just have to look for professional literature or a program. However, Bert PA1B wrote a program, more precisely an Excel macro, which also calculates the power load of individual elements. The following picture explains it:

In the assignment, I will determine the attenuation, input/output power and power load capacity of the resistors. The macro recalculates a suitable combination of resistors from the E12 series, which is commonly available. The sample attenuator can be assembled from two resistors 330 ohm/2W and one 680 ohm/1W, two 100 ohm/2W with one 470 ohm/0.5W, and one 150 ohm/1W with 1000 ohm/0.1W is enough on the output side. In addition, the script calculates the input, output voltage, current flowing and the accuracy of the value of the resistors connected in parallel. Attenuation values of 1, 2, 3, 7, 10 or 20 dB are available.
You can find the Excel calculator of the power attenuation element at https://a29.veron.nl/wp-content/uploads/2015/12/PowerAtt.xls
