Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure Optimization - Margin Analysis

Anonymous I've got another one :-).   I need help with multiple cuts of margin and those cuts % of the total revenue.   In essence, we have three types of bids: 1. In-house 2. Subcontracted 3....
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

     

    It took a little bit time to go through your measures. The -3045% came with a little modification on your original ones, all the EstimateTotalCost, you only need to add all the cost, but not iteration (means no SUMX).

     

    Is the Margin% comparing with TotalCost not Revenue?

     

    InHouseMargins =
    
    VAR T1 =
        GENERATE (
            GROUPBY ( SalesHistory, SalesHistory[SO] ),
            VAR EstimateType = [EstimateType]
            VAR TotalRevenue = [SumTotalRevenue]
            VAR TotalCost = [EstimatedTotalCost]
            RETURN
                ROW (
                    "EstType", EstimateType,
                    "TotalRevenue", TotalRevenue,
                    "TotalCost", TotalCost
                )
        )
    VAR T2 =
        FILTER ( T1, [EstType] = "In-House" )
    RETURN
        ( SUMX ( T2, [TotalRevenue] ) - SUMX ( T2, [TotalCost] ) )
            / SUMX ( T2, [TotalCost] )

     

    Basically, I re wrote some of your measures. There should be better ways, but I checked the performance of mine in DAX Studio, all seem ok. PM your email, I can send you the .pbix file.