This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hello Experst,
I am getting below error while using dynamic formatting as
Can someone help me as what I am doing wrong here.
Solved! Go to Solution.
Hi, @Ferha_Jafri
I’ve provided two solutions for you:
1.Firstly, modify the format as follows:
var selected_toggle1 = SELECTEDVALUE(View[Value])
var var_value1 = SWITCH(TRUE(),
selected_toggle1 = "Total Premium","$#,0" ,
selected_toggle1 = "Total Incurred", "$#,0" ,
selected_toggle1 = "No. of Claims", "#,0"
,"0"
)
RETURN var_value1
The error occurred previously because you returned 0 instead of “0”. The output might be a number rather than a string.
2.Secondly, directly modify the measure to the following measure:
Measure =
var selected_toggle = SELECTEDVALUE(View[Value])
var var_value = SWITCH(TRUE(),
selected_toggle = "Total Premium",FORMAT([Sum_Premium],"$#,0"),
selected_toggle = "Total Incurred",FORMAT([Sum_Incured],"$#,0"),
selected_toggle = "No. of Claims",FORMAT([# Claims],"#,0"),0
)
RETURN var_value
This way, the format will be corrected directly when the measure outputs.
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Ferha_Jafri
I’ve provided two solutions for you:
1.Firstly, modify the format as follows:
var selected_toggle1 = SELECTEDVALUE(View[Value])
var var_value1 = SWITCH(TRUE(),
selected_toggle1 = "Total Premium","$#,0" ,
selected_toggle1 = "Total Incurred", "$#,0" ,
selected_toggle1 = "No. of Claims", "#,0"
,"0"
)
RETURN var_value1
The error occurred previously because you returned 0 instead of “0”. The output might be a number rather than a string.
2.Secondly, directly modify the measure to the following measure:
Measure =
var selected_toggle = SELECTEDVALUE(View[Value])
var var_value = SWITCH(TRUE(),
selected_toggle = "Total Premium",FORMAT([Sum_Premium],"$#,0"),
selected_toggle = "Total Incurred",FORMAT([Sum_Incured],"$#,0"),
selected_toggle = "No. of Claims",FORMAT([# Claims],"#,0"),0
)
RETURN var_value
This way, the format will be corrected directly when the measure outputs.
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |