Forum Discussion

sebbyp's avatar
sebbyp
Helper III
8 years ago
Solved

Quick Measure Calculate difference from another row

Hi there, i am trying to use quick measure for the first time as i thought this functionality could help me out on this occasion.  I have one dataset containing various economic indicator times series for many different countries.

 

I want to take economic indicator A for Country US and calculate the difference compared with Country EU.

 

 

Any ideas please as the result i get is zero?

 

Thanks in advance

  • Hi sebbyp,

     

    Replace DIVIDE with your formula. For example.

    Measure 5 =
    VAR US =
        CALCULATE ( SUM ( 'Table1'[Macro Trend Score] ), 'Table1'[Country] = "US" )
    VAR EU =
        CALCULATE ( SUM ( Table1[Macro Trend Score] ), 'Table1'[Country] = "EU" )
    RETURN
        US - EU

    Best Regards!

    Dale

5 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi sebbyp,

     

    Try this formula please. 

     

    Measure =
    VAR US =
        CALCULATE ( SUM ( 'Table1'[Macro Trend Score] ), 'Table1'[Country] = "US" )
    VAR EU =
        CALCULATE ( SUM ( Table1[Macro Trend Score] ), 'Table1'[Country] = "EU" )
    RETURN
        DIVIDE ( us, eu, 0 )

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards!

    Dale

    • sebbyp's avatar
      sebbyp
      Helper III

      v-jiascu-msftthank you for the help.  I see your formula works but you have used the divide function when i was looking for the difference between the two results.  What should i replace DIVIDE with to get a subtraction? for example US - EU?

      • v-jiascu-msft's avatar
        v-jiascu-msft
        Microsoft Employee

        Hi sebbyp,

         

        Replace DIVIDE with your formula. For example.

        Measure 5 =
        VAR US =
            CALCULATE ( SUM ( 'Table1'[Macro Trend Score] ), 'Table1'[Country] = "US" )
        VAR EU =
            CALCULATE ( SUM ( Table1[Macro Trend Score] ), 'Table1'[Country] = "EU" )
        RETURN
            US - EU

        Best Regards!

        Dale