Forum Discussion

hallpalmjame's avatar
hallpalmjame
New Member
7 years ago
Solved

Distributing booking value across start and end dates

Hi I am a Power BI novice and am trying to distribute revenue over a time period. I looked at a couple of posts, but can not replicate the solutions.  Have created a dates table DimDates, and am try...
  • Anonymous's avatar
    Anonymous
    7 years ago

    This can be done with dax, but would have to mix filters and relationships, etc. So if you arent opposed to using Power Query, this can be done pretty easily.  I attached the pbix file below, but basically it is doing:

    1. Find the amount of days between start and end ( you have a column in there already, but wanted to make this work with whatever future data you may have)
    2. Add a custom column that produces a list of dates beteen that start and end date
    List.Dates([Start Date], [Days Between], #duration(1,0,0,0) )
    1. Divide out the USD amount and the days between from #1 above. Again, you had this in there, but wanted to be sure it would work in the future
    2. Remove the misc columns we no longer need
    3. Expand the list of dates. So this will have the average value per day
    4. Relate the DimDate to this table ( also, be sure to mark the date table as a Date Table in the Data view, also be sure to sort the Month Name by the Month Number column)

     

    Then just a simple sum formula:

    Easy Sum = sum( Table1[Avg Per Day] )

    And the final table:

     

    Here's the file so you can step through the applied steps (  you can ignore the first couple as I was having trouble with the dates)

    https://1drv.ms/u/s!Amqd8ArUSwDS0ED7IECT7MD60OHq

  • v-lili6-msft's avatar
    v-lili6-msft
    7 years ago

    hi, hallpalmjame 

    Try this way as below:

    Create a new table

    Table = FILTER(CROSSJOIN(Bookings,DimDates),Bookings[StartDate]<='DimDates'[Date]&&Bookings[EndDate]>='DimDates'[Date])

    Then drag date and DAYUSD from New table

     

    here is pbix file,please try it.

     

    Best Regards,

    Lin