Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

% Diff by Category

Hello, I am a novice at DAX and am looking for help on create a percent diff measure based on category.

 

Here's the raw data 

 

SystemRunTime
A5
B

7

 

Here's what I am like to do

SystemAB% Diff
RunTime5771%

 

This is super easy in Excel but PowerBI is a different animal.

 

Thanks

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    First, Transform data>>Transform>>Transpose>>use first row as headers

    Then create a measure.

    %diff = SELECTEDVALUE('Table'[A])/SELECTEDVALUE('Table'[B])

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

     

     

    Best Regards

    Community Support Team _ Polly

     

2 Replies

  • Hi Anonymous

     

    Try the following

     

    % difference =
    DIVIDE (
        CALCULATE ( SUM ( Table[Runtime] ), Table[System] = "A" ),
        CALCULATE ( SUM ( Table[Runtime] ), Table[System] = "B" )
    )

     

    Be aware that if you want a dinamic approach this needs to be changed and the values of each of the system need to be a formula also. 

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    First, Transform data>>Transform>>Transpose>>use first row as headers

    Then create a measure.

    %diff = SELECTEDVALUE('Table'[A])/SELECTEDVALUE('Table'[B])

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

     

     

    Best Regards

    Community Support Team _ Polly