Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Dax calc issue

Hi im having trouble making this dax calc work... could i get some help please

PENN again = divide (sumx(Pen,Pen[Total New Contracts - New Volvo Products - Number of Units]),SUMX(Pen,Pen[Number of Vehicles Delivered]))


I just want to get an avg of these by dividing contracts by vehicles delivered however when added to the visuals it doesnt load - just an error message 

  • Hi Anonymous ,

    You can create a very simple measure if you just need to calculate the average. 

    New_Avg = divide(sum(Vehicles[Contracts - New Volvo Products]), sum(Vehicles[Vehicles Delivered]),0)


    As for the error message in your measure, please ensure that the datatype for both columns is numeric before you perform the divide operation. 
    This is your measure working fine on my pbix

    PENN again = divide (sumx(Vehicles,Vehicles[Contracts - New Volvo Products]- Vehicles[Vehicles Delivered]),SUMX(Vehicles,Vehicles[Vehicles Delivered]))

    Please mark this answer as the solution if it resolved your issue.

    Kind regards,

    Rohit

     

2 Replies

  • Hello Anonymous ,

     

    Request you to please share sample data in tabular format (not picture) and expected output so that we can help you.

    Thanks.

     

     

  • Hi Anonymous ,

    You can create a very simple measure if you just need to calculate the average. 

    New_Avg = divide(sum(Vehicles[Contracts - New Volvo Products]), sum(Vehicles[Vehicles Delivered]),0)


    As for the error message in your measure, please ensure that the datatype for both columns is numeric before you perform the divide operation. 
    This is your measure working fine on my pbix

    PENN again = divide (sumx(Vehicles,Vehicles[Contracts - New Volvo Products]- Vehicles[Vehicles Delivered]),SUMX(Vehicles,Vehicles[Vehicles Delivered]))

    Please mark this answer as the solution if it resolved your issue.

    Kind regards,

    Rohit