Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

calculate account gp

account codecompanyamount
11999010
1599905
53999075
56999055
589990566
69999074
76999054
119991456
1599912545
539991445
5699914545
5899914456
69999145
76999145

 

given this table with account code company and amount

, i want be able to calculate for example for each company

the measure of account code 15999/58999

how i can do that?

  • Hi Anonymous,

     

    To create a measure as below.

     

    Measure = 
    VAR sum2 =
        CALCULATE (
            SUM ( Table1[amount] ),
            FILTER ( Table1, Table1[account code] = 15999 )
        )
    VAR sum1 =
        CALCULATE (
            SUM ( Table1[amount] ),
            FILTER ( Table1, Table1[account code] = 58999 )
        )
    RETURN
        sum2 / sum1
    

    For more details, please check the pbix as attached.

     

    Regards,

    Frank

6 Replies

  • Is there a relation between account codes, or you want to specifically calculate the values for 15999/58999, please elaborate

    • Anonymous's avatar
      Anonymous
      Not applicable

      I need to calculate the amount associated to account code 15999 / amount associate with 58999 associated to company 1 (456/4456) 

      I need to calculate the amount associated to account code 15999 / amount associate with 58999 associated to company 0 (10/566)

      • yelsherif's avatar
        yelsherif
        Icon for Resolver IV rankResolver IV

        you can create a measure like:

        Measure0 = divide(

               calculate(sum(accounts[amount]),accounts[account code] = 15999, accounts[company] = 0), 
               calculate(sum(accounts[amount]),accounts[account code] = 58999, accounts[company] = 0),
               0)

         

        Measure1 = divide(

               calculate(sum(accounts[amount]),accounts[account code] = 15999, accounts[company] = 1), 
               calculate(sum(accounts[amount]),accounts[account code] = 58999, accounts[company] = 1),
               0)

  • v-frfei-msft's avatar
    v-frfei-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous,

     

    To create a measure as below.

     

    Measure = 
    VAR sum2 =
        CALCULATE (
            SUM ( Table1[amount] ),
            FILTER ( Table1, Table1[account code] = 15999 )
        )
    VAR sum1 =
        CALCULATE (
            SUM ( Table1[amount] ),
            FILTER ( Table1, Table1[account code] = 58999 )
        )
    RETURN
        sum2 / sum1
    

    For more details, please check the pbix as attached.

     

    Regards,

    Frank

    • v-frfei-msft's avatar
      v-frfei-msft
      Icon for Community Support rankCommunity Support

      Hi Anonymous ,

       

      Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

       

      Regards,
      Frank