Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Divide 2 Calculated Columns

I have these two columns as measures.  The work great as individual metrics. 

I want to divide these 2.  When I set up the following DAX I get "Infinity" as a result in my table.

 

SignupOpsPercent =
CALCULATE(COUNT(CallLogging[CALL_ID]),FILTER(CallLogging,CallLogging[CALL_TYPE]="signup"))/
CALCULATE(COUNT(CallLogging[CALL_ID]),FILTER(CallLogging,CallLogging[CALL_TYPE2]="Opps"))
 
Thanks for all the great help on this!
Scott
  • AilleryO's avatar
    AilleryO
    6 years ago

    One thing I don't understand, you said you have 2 measures, so why are you not divinding those 2 using DIVIDE() function :

    DIVIDE(measure1, measure2)

    If you have 2 calculated columns, then it's different. (Calculated columns are visible in Data Vieaw and are calculating on each lines, measures are not visible in Data View but are listed in Field panel (with a specific icon, see below the black calculator is a measure, and the other one with a grey column, is calculated column). Measure can make a sum of a column for instance.

    ).

     

    Otherwise I think your trouble might be linked to the context of your table, could you tell us more about the context in which you are are trying to divide the 2.

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Try using IFERROR function to your DAX measure.

    That will solve the issue.

    =IFERROR( value, value_if_error)

     

    SignupOpsPercent =
    IFERROR(CALCULATE(COUNT(CallLogging[CALL_ID]),FILTER(CallLogging,CallLogging[CALL_TYPE]="signup"))/
    CALCULATE(COUNT(CallLogging[CALL_ID]),FILTER(CallLogging,CallLogging[CALL_TYPE2]="Opps")),0)
     
    Thank you,
     
    If this helps resolve your issue please mark it it as a solution
  • Anonymous try this

     

    SignupOpsPercent =
    DIVIDE(
    CALCULATE(COUNT(CallLogging[CALL_ID]),CallLogging[CALL_TYPE]="signup"),
    CALCULATE(COUNT(CallLogging[CALL_ID]),CallLogging[CALL_TYPE2]="Opps"),
    0
    )

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Parry, I tried this and all I get is 0 for every row. The same thing happens with IFERROR - all zeros.

      • AilleryO's avatar
        AilleryO
        Memorable Member

        One thing I don't understand, you said you have 2 measures, so why are you not divinding those 2 using DIVIDE() function :

        DIVIDE(measure1, measure2)

        If you have 2 calculated columns, then it's different. (Calculated columns are visible in Data Vieaw and are calculating on each lines, measures are not visible in Data View but are listed in Field panel (with a specific icon, see below the black calculator is a measure, and the other one with a grey column, is calculated column). Measure can make a sum of a column for instance.

        ).

         

        Otherwise I think your trouble might be linked to the context of your table, could you tell us more about the context in which you are are trying to divide the 2.