Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I would like to ask for your help. How can I get the "Previous month Average Temperature (Whole month)"
I have my date dimension and fact table for the temperature but I am not getting my desired result. Below is my dax.
Here's my sample data and expected answer:
| Year | Month | Day | Average Temperature |
| 2023 | July | 1 | 30.90 |
| 2023 | July | 2 | 29.10 |
| 2023 | July | 3 | 29.80 |
| 2023 | July | 4 | 29.50 |
| 2023 | July | 5 | 30.15 |
| 2023 | July | 6 | 30.80 |
| 2023 | July | 7 | 29.90 |
| 2023 | July | 8 | 29.90 |
| 2023 | July | 9 | 29.95 |
| 2023 | July | 10 | 28.65 |
| 2023 | July | 11 | 29.45 |
| 2023 | July | 12 | 29.70 |
| 2023 | July | 13 | 24.80 |
| 2023 | July | 14 | 27.50 |
| 2023 | July | 15 | 27.25 |
| 2023 | July | 16 | 27.25 |
| 2023 | July | 17 | 28.20 |
| 2023 | July | 18 | 28.95 |
| 2023 | July | 19 | 28.30 |
| 2023 | July | 20 | 28.70 |
| 2023 | July | 21 | 29.55 |
| 2023 | July | 22 | 28.60 |
| 2023 | July | 23 | 28.60 |
| 2023 | July | 24 | 28.35 |
| 2023 | July | 25 | 28.80 |
| 2023 | July | 26 | 28.15 |
| 2023 | July | 27 | 27.35 |
| 2023 | July | 28 | 27.20 |
| 2023 | July | 29 | 26.55 |
| 2023 | July | 30 | 26.35 |
| 2023 | July | 31 | 27.00 |
| 2023 | Aug | 1 | 25.70 |
| 2023 | Aug | 2 | 26.85 |
| 2023 | Aug | 3 | 27.90 |
| 2023 | Aug | 4 | 28.45 |
| Expected Values: | |
| Current Month Average Temp (August 1 -5) | Previous Month Average Temp (July 1-31) |
| 27.22 | 28.56 |
Solved! Go to Solution.
Hi @icdns ,
Please check the pbix file.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Here's my sample data and expected answer:
| Year | Month | Day | Average Temperature |
| 2023 | July | 1 | 30.90 |
| 2023 | July | 2 | 29.10 |
| 2023 | July | 3 | 29.80 |
| 2023 | July | 4 | 29.50 |
| 2023 | July | 5 | 30.15 |
| 2023 | July | 6 | 30.80 |
| 2023 | July | 7 | 29.90 |
| 2023 | July | 8 | 29.90 |
| 2023 | July | 9 | 29.95 |
| 2023 | July | 10 | 28.65 |
| 2023 | July | 11 | 29.45 |
| 2023 | July | 12 | 29.70 |
| 2023 | July | 13 | 24.80 |
| 2023 | July | 14 | 27.50 |
| 2023 | July | 15 | 27.25 |
| 2023 | July | 16 | 27.25 |
| 2023 | July | 17 | 28.20 |
| 2023 | July | 18 | 28.95 |
| 2023 | July | 19 | 28.30 |
| 2023 | July | 20 | 28.70 |
| 2023 | July | 21 | 29.55 |
| 2023 | July | 22 | 28.60 |
| 2023 | July | 23 | 28.60 |
| 2023 | July | 24 | 28.35 |
| 2023 | July | 25 | 28.80 |
| 2023 | July | 26 | 28.15 |
| 2023 | July | 27 | 27.35 |
| 2023 | July | 28 | 27.20 |
| 2023 | July | 29 | 26.55 |
| 2023 | July | 30 | 26.35 |
| 2023 | July | 31 | 27.00 |
| 2023 | Aug | 1 | 25.70 |
| 2023 | Aug | 2 | 26.85 |
| 2023 | Aug | 3 | 27.90 |
| 2023 | Aug | 4 | 28.45 |
| Expected Values: | |
| Current Month Average Temp (August 1 -5) | Previous Month Average Temp (July 1-31) |
| 27.22 | 28.56 |
Please try the Parallel period Dax , explained in the below tutorial. You can create the AVG dax instead of SUM.
Hello,
Thank you for this but i won't be displaying the temp together with the month. I will only display it separately that's why I need it as a dax 😞
Hi @icdns ,
Please check the pbix file.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi,
I really do not know the result that you want.
Hi @icdns
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523