Forum Discussion

ckolahi's avatar
ckolahi
Frequent Visitor
4 years ago
Solved

Create a calculated column actuals vs Budget

  • Hi PBI experts.

I am new here and starting with PBI so apologies in advance if the question is stupid.

 

I have a situation. Here is the table, the columns in black are the ones I have and I need to create a calculated column (in red) showing a target achievement per reps (as decribed in the table below). 

 

As anyone have an idea if its possible ?  Thank you in advance for your help

 

 

 

  • ckolahi Assuming a Status of A is actuals and B is budget, maybe:

    % Achievement Column = 
      VAR __Name = [Name]
      VAR __Measure = [Measure_SIP]
      VAR __Status = [Status]
      VAR __Month = [Month]
      VAr __Year = [Year]
    RETURN
      IF(
        __Status = "B",
        0,
          VAR __Actual = IF(__Measure = "Net Sales USD", [Net_Sales_USD], [Units])
          VAR __Table = FILTER('Table',[Name] = __Name && [Measure_SIP] = __Measure && [Status] = "B" && [Month] = __Month && [Year] = __Year)
          VAR __Budget = IF(__Measure = "Net Sales USD", MAXX(__Table, [Net_Sales_USD]), MAXX(__Table, [Units])
        RETURN
          DIVIDE(__Actual, __Budget, 0)
      )

    That said, I think you should look into unpivoting your Net_Sales_USD and Units columns and this would likely be a far easier calculation.

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    ckolahi Assuming a Status of A is actuals and B is budget, maybe:

    % Achievement Column = 
      VAR __Name = [Name]
      VAR __Measure = [Measure_SIP]
      VAR __Status = [Status]
      VAR __Month = [Month]
      VAr __Year = [Year]
    RETURN
      IF(
        __Status = "B",
        0,
          VAR __Actual = IF(__Measure = "Net Sales USD", [Net_Sales_USD], [Units])
          VAR __Table = FILTER('Table',[Name] = __Name && [Measure_SIP] = __Measure && [Status] = "B" && [Month] = __Month && [Year] = __Year)
          VAR __Budget = IF(__Measure = "Net Sales USD", MAXX(__Table, [Net_Sales_USD]), MAXX(__Table, [Units])
        RETURN
          DIVIDE(__Actual, __Budget, 0)
      )

    That said, I think you should look into unpivoting your Net_Sales_USD and Units columns and this would likely be a far easier calculation.