Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Divide two columns using DAX

I'm trying to divide two columns by using DAX. I've always struggled with this functionality in the past and thought I got this but I can't get my head around why it wouldn't work. 

The formula doing a measure: (I tried count function also)

 

Output:

It should calculate 3521/41770 = 0.084

 

 

  • parry2k's avatar
    parry2k
    7 years ago

    Anonymous so as per your screen shot, you need to change data type to decimal number and decimal point to 2 or 3, didn't seems like you did that?

10 Replies

  • Anonymous just to clarify, you are adding a measure, correct?

     

    Based on screen shot, seems like you are doing count of disputes and transactions, although you said, you tried count, but not worked, what did you get? Same zero?

    • parry2k's avatar
      parry2k
      Super User

      Anonymous also can you check the data type of this new measure, make sure it is not a whole number but decimal number with 2 or 3 decimal position, based on screen shot, it looks like it is whole number and in that case you will see 0 and no decimal point, and your calculation is returning decimal point.

    • Anonymous's avatar
      Anonymous
      Not applicable

      yeah parry2k , it is a measure. 

      When I do count: Disputes divided by Transactions = DIVIDE(count('Disputes'[Disputes]), count('Disputes'[Transactions])) - nothing changes.

       

      The two columns I'm using in the formula are Transaction and Disputes IDs that I am counting in that table already and then trying to use DAX to get the ratio. 

       

      • parry2k's avatar
        parry2k
        Super User

        Anonymous did you checked the data type