Forum Discussion
Divide a quantity between given months
Hello everyone
I'm not sure how to proceed, and I could use some help.
I have these fields:
- Amount (say, 1,200 Euros)
- Start date (say, 01-January-2020)
- End date (say, 31 say-2020).
In the source table, there is one line for each product:
| Up ID | Product | Start date | End date | Amount |
| 1 | Main product | 01-January-2020 | 31-12-2020 | 1200 |
I need to have the amount equally divided between the months of the start and end date.
The goal would be a table like this:
| Up ID + Producto | Income Month-Year | Amount of income |
| 1 - Main product | January-2020 | 100 |
| 1 - Main product | February-2020 | 100 |
| 1 - Main product | ... | |
| 1 - Main product | Dec-2020 | 100 |
The dates would be in different years, so building a column for each month could be daunting.
The key would be the only Opp ID + Product...
Thanks a lot
Alice
AliceW ,
You can creae a measure using dax below:
Result = CALCULATE ( SUM ( Table[Amount] ), ALLEXCEPT ( Table, Table[Up ID], Table[Product] ) ) / DATEDIFF ( Table[Start date], Table[End date], MONTH )Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- Greg_DecklerCommunity Champion
I believe you need a variation of this:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Revenue-Reverse-YTD/m-p/373185#M111
- v-yuta-msftCommunity Support
AliceW ,
You can creae a measure using dax below:
Result = CALCULATE ( SUM ( Table[Amount] ), ALLEXCEPT ( Table, Table[Up ID], Table[Product] ) ) / DATEDIFF ( Table[Start date], Table[End date], MONTH )Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.