Forum Discussion

FinanceBI's avatar
FinanceBI
Frequent Visitor
7 years ago
Solved

Month-Over-Month on Multiple Items

Hello All,   I'm looking to calculate the month-over-month return for multiple investments funds. From my understanding, I cannot use the quick measure because I would need to select one base value...
  • Anonymous's avatar
    Anonymous
    7 years ago

    I attached the pbix file below, but here's what I did:

    • Need a dedicated Calendar/Date table. Small function in Power Query that will create a basic one for you
    • Once that is loaded, be sure to mark the DimDate table as a Date Table.  Need to do this to ensure the time intelligence function below will work correctly. 
    • Relate that to your Fact table.  Will use the DateKey from the DimDate table as your filters (sidebar: you may want to have other dimesion tables for the Name and Strategey since you really dont want to filter fact tables, but if the table is not too big it should work fine)

     

    Create these measures:

    Just a simple average. 

     

    Simple Average = AVERAGE( FactReturn[Monthly Return Rate] )
    MoM Change = 
    //Checks to see if there is a monthly return
    IF ( 
        NOT( 
            ISBLANK([Simple Average])
        ),
    
    //Checks to see of the return is the first in the return stream
    //if so, it will return First Date, but can put anything there
        IF(
           CALCULATE( 
               COUNTROWS( FactReturn ), 
                FILTER( 
                    ALL( DimDate), 
                    DimDate[DateKey] <= max( DimDate[DateKey]))
           ) =1,
            "FirstDate"
        ,
    
    //Assuming their is a return and its not the 1st in the stream
    //Takes the average return in current filter context and subtracts
    //The return from the previous month 
        [Simple Average] - 
            CALCULATE( 
                [Simple Average], 
                PREVIOUSMONTH ( DimDate[DateKey])
            )
        )
    )

    Final Matrix:

     

    Still the issue what you would wnt to do at the total level. Could be average of the changes, whatever the last change was, or maybe dont even need them. But should be a good start

     

    File:

    https://1drv.ms/u/s!Amqd8ArUSwDS0zAk-xUYbEuuGXI8