Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Split Revenue per Month

Hi all   Its more like a generel data question, but im wondering if Power BI may be able to solve it easyli. I have a orderlines table with columns "From" and "Till". Lets say one orderline gener...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Let's see how this goes. 

     

    First things first, I noticed a small error in the inital Revenue Split. 

    Please change the 4th step in the Applied Steps for the NewOrderLines table to:

    [Price] / 
    (Duration.Days([Till] - [From] ) +1)

    Need to add parentheses around the entire denominator. So that will change the split revenue to the correct split, so a a little different than your screenshot. 

     

    If you look in Power Query ( file is down below) you will see a fnCreateCalendar function. This is a small function I wrote that you enter in the start year and the end year and will produce a list of all the dates. From there, convert to a table and add whatever columns you want. Pretty clear in the file.  But that produces a DimCalendar. Which I then related that DimCalendar to the NewOrderLines ( 1:M) using the Date Column from DimCalendar to Dates in the NewOrderLines. That dates column is all the dates of the split revenue. 

     

    So our data model looks like this now:

     

    Now we will use columns from the DimCalendar table for our matrix and filters.  So I'm thinking that other table you have is not really needed as it appears all that info is now coming from the DimCalendar table and filtering the NewOrderLines table.  

     

    We get this matrix,  which sums the total split revenue by date by the simple formula:

    Total Split Rev = SUM( NewOrderlines[SplittedRev] )

     

    Here's the PBIX file. I also added a screenshot on how to mark the Calendar table as a date table.

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