Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Dynamic format Strings and showing multiples of 10

vicky__0-1739841955287.png

 

Data:

 

Order_ID Item_ID Item Qty
A 1 1000
A 2 500
A 3 100
B 1 41
B 2 200
C 1 500
C 3 70

Measure:

 

Order-Item Qty = CALCULATE(SUM('Order-Item'[Item Qty]))

 


Format String:

 

var allProds =  FORMAT(SELECTEDMEASURE(), " | 0")
// RETURN "#,##0." & allProds this works and gives the expected results
RETURN "#,##0" & allProds // without the . it removes the trailing 0s

 

I've encountered an issue with dynamic format strings and showing numbers ending in 0, where all the "trailing" 0s are missing when applying dynamic format strings.
For example, in the trivial example above, I expect the 1st row to show 1,000 | 1,000 and the 2nd row to show 500 | 500. Note that the 4th row is showing correctly. The numbers will also display correctly if I try to add a decimal point.

Status: Investigating

Hi,@vicky_ .
To add to this.
In the meantime, I hope the links below are helpful.
Custom numeric format strings - .NET | Microsoft Learn

vjtianmsft_0-1739938228775.png

FORMAT function (DAX) - DAX | Microsoft Learn

Comments
v-jtian-msft
Community Support
Status changed to: Investigating

Hi,@vicky_ .I am glad to help you.

This is indeed strange, I tested it and reproduced the same problem as you.

var allProds =  FORMAT(SELECTEDMEASURE(), " | 0")
// RETURN "#,##0." & allProds this works and gives the expected results
RETURN "#,##0" & allProds // without the . it removes the trailing 0s

error



var allProds = FORMAT(SELECTEDMEASURE(), " | 0")
RETURN "#,##0.0" & allProds

vjtianmsft_0-1739937881971.png

vjtianmsft_1-1739937888615.png

var allProds =  FORMAT(SELECTEDMEASURE(), " | 0")

RETURN "#,##0" & allProds

var allProds = FORMAT(SELECTEDMEASURE(), " | 0")
RETURN "#,##0.0" & allProds



I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian

v-jtian-msft
Community Support
Status changed to: Investigating

Hi,@vicky_ .
To add to this.
In the meantime, I hope the links below are helpful.
Custom numeric format strings - .NET | Microsoft Learn

vjtianmsft_0-1739938228775.png

FORMAT function (DAX) - DAX | Microsoft Learn