Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have this table two fields
unit qty
each 3.00
each 2.00
kg 0.450
kg 0.030
I want to format qty without deceimal for each unit and 2 decimal with kg as below
unit qty
each 3
each 2
kg 0.450
kg 0.030
Solved! Go to Solution.
@adnankabina , You have use format Function that will make it text meausre Assume Qty is meausre of use sum(Table[Qty])
Switch(True() ,
Max(Table[Unit]) = "Unit", format([Qty], "#,###") ,
format([Qty], "#,###,000")
)
Hi @adnankabina ,
For your requirement, you need to convert the data type as text type.
You can create the following calculated column.
expected = SWITCH([unit],"each",FORMAT([qty],"#,###"),"kg",FORMAT([qty],"#,##0.000"))
As you can see, the calculated column is text type. If you want to use this field in a new calculated column or measure, you can use the VALUE function or use the original qty column.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @adnankabina ,
For your requirement, you need to convert the data type as text type.
You can create the following calculated column.
expected = SWITCH([unit],"each",FORMAT([qty],"#,###"),"kg",FORMAT([qty],"#,##0.000"))
As you can see, the calculated column is text type. If you want to use this field in a new calculated column or measure, you can use the VALUE function or use the original qty column.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you guys. 🙂
@adnankabina , You have use format Function that will make it text meausre Assume Qty is meausre of use sum(Table[Qty])
Switch(True() ,
Max(Table[Unit]) = "Unit", format([Qty], "#,###") ,
format([Qty], "#,###,000")
)
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
117 | |
101 | |
71 | |
61 |