Forum Discussion

FatBlackCat30's avatar
FatBlackCat30
Microsoft Employee
5 years ago
Solved

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:

 

dateIDTypeValue
2/1/20211customer10
2/1/20211internal 15
1/31/20211customer20
1/31/20211internal 56
1/29/20211customer96
1/29/20211internal 103
1/28/20211customer125
1/28/20211internal 146
1/27/20211customer167
1/27/20211internal 189
1/26/20211customer210
1/26/20211internal 231
1/25/20211customer252
1/25/20211internal 274
1/24/20211customer295
1/24/20211internal 316
1/23/20211customer338
1/23/20211internal 359
1/22/20211customer380
1/22/20211internal 402
1/21/20211customer423
1/21/20211internal 444
1/20/20211customer465
1/20/20211internal 487
1/19/20211customer508
1/19/20211internal 529
1/18/20211customer551
1/18/20211internal 572
1/17/20211customer593
1/17/20211internal 615
1/16/20211customer636
1/16/20211internal 657
1/15/20211customer678
1/15/20211internal 700
1/14/20211customer721
1/14/20211internal 742
1/13/20211customer764
1/13/20211internal 785
1/12/20211customer806
1/12/20211internal 828
1/11/20211customer849
1/11/20211internal 870
1/10/20211customer891
1/10/20211internal 913
1/9/20211customer934
1/9/20211internal 955
1/8/20211customer977
1/8/20211internal 998
1/7/20211customer1019
1/7/20211internal 1041
1/6/20211customer1062
1/6/20211internal 1083
1/5/20211customer1104
1/5/20211internal 1126
1/4/20211customer1147
1/4/20211internal 1168
1/3/20211customer1190
1/3/20211internal 1211
1/2/20211customer1232
1/2/20211internal 1254
1/1/20211customer1275
1/1/20211internal 1296
12/31/20201customer1317
12/31/20201internal 1339

 

Thank you!

3 Replies

  • 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.

  • 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.