Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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")
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |