Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Creating a measure that divides two colums

Hi!

 

I wish to create a measure that divides Column 1 by Column 2.

 

How do write a DAX for this as a measure?

 

Thanks!

  • Hi Anonymous ,

     

    According to your question, you can try the following formula:

    Measure = 
    var a = SUM('Table'[Column1])
    var b = SUM('Table'[Column2])
    
    return
     DIVIDE(a,b,0)

     

     

    In addition, if you want to have a further understanding of the Divide function, you can refer to the official website document:DAX: DIVIDE function vs divide operator (/) - Power BI | Microsoft Docs


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry

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

3 Replies

  • Anonymous ,

    New measure = divide(sum(Table[Column 1]),sum(Table[Column 2])) // Sum can be count

     

    or

    New measure = Averagex(Table, Divide(Table[Column 1],Table[Column 2]))

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    According to your question, you can try the following formula:

    Measure = 
    var a = SUM('Table'[Column1])
    var b = SUM('Table'[Column2])
    
    return
     DIVIDE(a,b,0)

     

     

    In addition, if you want to have a further understanding of the Divide function, you can refer to the official website document:DAX: DIVIDE function vs divide operator (/) - Power BI | Microsoft Docs


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry

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