Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello everyone,
I want to make the format of my column Sales/QTY dynamic according to the ProductID:
when ProductId = 2 ==> 2 decimal
ProductId = 3 ==> 3 decimal
Please check the table below
| Product Id | Sales/QTY |
| 100 | 3 |
| 1 | 0,2 |
| 2 | 0,03 |
| 3 | 0,005 |
| 4 | 0,0006 |
Thank you
Solved! Go to Solution.
Hi @TITO22
Sample:
You can create a measure as follows.
Sales/QTY1 =
VAR _rept = MAX([Product id])
VAR _sales = MAX([Sales/QTY])
VAR _number = IF(LEN(_rept) = 1, CONCATENATE(REPT(0, _rept), _sales), _sales)
RETURN
IF(LEN(_rept) = 1, LEFT(_number, 1) & "." & RIGHT(_number, _rept), _sales)
Modify the Format:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @TITO22
Sample:
You can create a measure as follows.
Sales/QTY1 =
VAR _rept = MAX([Product id])
VAR _sales = MAX([Sales/QTY])
VAR _number = IF(LEN(_rept) = 1, CONCATENATE(REPT(0, _rept), _sales), _sales)
RETURN
IF(LEN(_rept) = 1, LEFT(_number, 1) & "." & RIGHT(_number, _rept), _sales)
Modify the Format:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you 👍
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!