Forum Discussion
Mont over month calculation using DAX
Hi all,
I am trying to create a DAX measure to use in a card visual that will show the month over month change where type = customer
For this example I need to grab the 1/31/2021 value for type = customer (20) and subtract the 12/31/2020 value for type = customer (1317). I tried using the Prevmonth function but its not giving me the correct value. What would be the best approach to solve this?
The data looks like this:
| date | ID | Type | Value |
| 2/1/2021 | 1 | customer | 10 |
| 2/1/2021 | 1 | internal | 15 |
| 1/31/2021 | 1 | customer | 20 |
| 1/31/2021 | 1 | internal | 56 |
| 1/29/2021 | 1 | customer | 96 |
| 1/29/2021 | 1 | internal | 103 |
| 1/28/2021 | 1 | customer | 125 |
| 1/28/2021 | 1 | internal | 146 |
| 1/27/2021 | 1 | customer | 167 |
| 1/27/2021 | 1 | internal | 189 |
| 1/26/2021 | 1 | customer | 210 |
| 1/26/2021 | 1 | internal | 231 |
| 1/25/2021 | 1 | customer | 252 |
| 1/25/2021 | 1 | internal | 274 |
| 1/24/2021 | 1 | customer | 295 |
| 1/24/2021 | 1 | internal | 316 |
| 1/23/2021 | 1 | customer | 338 |
| 1/23/2021 | 1 | internal | 359 |
| 1/22/2021 | 1 | customer | 380 |
| 1/22/2021 | 1 | internal | 402 |
| 1/21/2021 | 1 | customer | 423 |
| 1/21/2021 | 1 | internal | 444 |
| 1/20/2021 | 1 | customer | 465 |
| 1/20/2021 | 1 | internal | 487 |
| 1/19/2021 | 1 | customer | 508 |
| 1/19/2021 | 1 | internal | 529 |
| 1/18/2021 | 1 | customer | 551 |
| 1/18/2021 | 1 | internal | 572 |
| 1/17/2021 | 1 | customer | 593 |
| 1/17/2021 | 1 | internal | 615 |
| 1/16/2021 | 1 | customer | 636 |
| 1/16/2021 | 1 | internal | 657 |
| 1/15/2021 | 1 | customer | 678 |
| 1/15/2021 | 1 | internal | 700 |
| 1/14/2021 | 1 | customer | 721 |
| 1/14/2021 | 1 | internal | 742 |
| 1/13/2021 | 1 | customer | 764 |
| 1/13/2021 | 1 | internal | 785 |
| 1/12/2021 | 1 | customer | 806 |
| 1/12/2021 | 1 | internal | 828 |
| 1/11/2021 | 1 | customer | 849 |
| 1/11/2021 | 1 | internal | 870 |
| 1/10/2021 | 1 | customer | 891 |
| 1/10/2021 | 1 | internal | 913 |
| 1/9/2021 | 1 | customer | 934 |
| 1/9/2021 | 1 | internal | 955 |
| 1/8/2021 | 1 | customer | 977 |
| 1/8/2021 | 1 | internal | 998 |
| 1/7/2021 | 1 | customer | 1019 |
| 1/7/2021 | 1 | internal | 1041 |
| 1/6/2021 | 1 | customer | 1062 |
| 1/6/2021 | 1 | internal | 1083 |
| 1/5/2021 | 1 | customer | 1104 |
| 1/5/2021 | 1 | internal | 1126 |
| 1/4/2021 | 1 | customer | 1147 |
| 1/4/2021 | 1 | internal | 1168 |
| 1/3/2021 | 1 | customer | 1190 |
| 1/3/2021 | 1 | internal | 1211 |
| 1/2/2021 | 1 | customer | 1232 |
| 1/2/2021 | 1 | internal | 1254 |
| 1/1/2021 | 1 | customer | 1275 |
| 1/1/2021 | 1 | internal | 1296 |
| 12/31/2020 | 1 | customer | 1317 |
| 12/31/2020 | 1 | internal | 1339 |
Thank you!
FatBlackCat30 solution attached, I added multiple measures to understand the solution. You can tweak it as you see fit.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
3 Replies
- parry2kSuper User
FatBlackCat30 solution attached, I added multiple measures to understand the solution. You can tweak it as you see fit.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- FatBlackCat30Microsoft Employee
this is perfect thank you very much
- parry2kSuper User
FatBlackCat30 glad it worked out, unfortunately, you marked your own reply as a solution. It doesn't matter but better you mark the actual reply as a solution so that others can take benefit from this solution. Just advice.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡