Forum Discussion

darrigg's avatar
darrigg
Frequent Visitor
4 years ago
Solved

Get Difference and % Difference In Matrix Table when values are Measures

Hi - I am trying to make 2 extra columns in the matrix below that calculate the difference and then the % difference of each one of these measures.   I created a matrix and swtiched values to rows....
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi darrigg ,

     

    As I mentioned above, I think [Actual vs Budget] in matrix column should be a column with only two values "Actual" and "Budget". So you add multiple measures or columns into value fields and matrix will expand into only two columns "Actual" and "Budget". 

    You can add a column with more values like "Actual", "Budget","Diff" and "Diff%" into Matrix column field.

    Then create measures by switch function. For example, [Direct Income] measure should look like as below.

    Direct Income =
    VAR _Acutal = [Actual for Direct Income]
    VAR _Budget = [Budget for Direct Income]
    VAR _DIFF = [Diff for Direct Income]
    VAR _DIFF_PERCENT = [Diff % for Direct Income]
    RETURN
        SWITCH (
            SELECTEDVALUE ( [ColumnField] ),
            "Actual", _Acutal,
            "Budget", _Budget,
            "DIFF", _DIFF,
            "DIFF%", _DIFF_PERCENT
        )

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.