Forum Discussion
Convert C to DAX
- 6 years ago
@NickProp28
Try these two measurements for 20 and 1020 Plt = INT(DIVIDE(SUM(TABLE[NO OF PACKAGES]),20)) 10 Plt = ROUNDUP(MOD(sum(TABLE[NO OF PACKAGES]),20),-1)/10________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click the Thumbs-Up icon on the right if you like this answer 🙂
- 6 years ago
Hello, @NickProp28
According to your description, I created data to reproduce your scenario. The pbix file is attached at the end.
Mesa:
You can create a measure like the following.
Result = var _value = SUM('Table'[No of Packages]) var _num20 = INT(DIVIDE(_value,20)) var _remain1 = MOD(_value,20) var _num10 = ROUNDUP(DIVIDE(_remain1,10),0) var _remain2 = MOD(_remain1,10) return IF( _value>20, IF( _remain1>0, _num20&" 20s pallet and "&_num10&" 10s pallet", _num20&" 20s pallet" ), INT(DIVIDE(_value,10))&" 10s pallet" )Result:
Best regards
Allan
If this post helps,then consider Accepting it as the solution to help other members find it more quickly.
- 6 years ago
It rounds one decimal place to the left of the decimal point.
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
NickProp28 , quotient and mod will help
https://docs.microsoft.com/en-us/dax/quotient-function-dax
https://docs.microsoft.com/en-us/dax/mod-function-dax
quotient([column],20)
mod([column],20)
Dear amitchandak,
Thanks for your prompt response,
I would like to create a measure based on no of packages, but im getting problem on it.