Strange number formating in ssas tabular? - powerbi

I have a ssas tabular cube. I have a question regarding formatting here:
I have number 1,000,000,000.5
By using format: #,##0,.0
it gets displayed as: 1,000,000.5
I have 2 questions:
What's the logic? how is #,##0,.0 instructing to remove 000?
Also, i would like to get rid of the decimal, and show it like 1,000,000 How can I do it?

Commas before the decimal point that are not followed by # or 0 divide the result by 1000.
Whatever digits it shows will be rounded to that precision. If you want to drop the decimal rather than rounding, you can use TRUNC or INT in the measure definition.

If you use the following format #,### will give you the following.

Related

Identify the value with highest number of decimal values

I have a range of values and I want to count the decimal points of all values in the range and display the max count. the formula should exclude the zeroes at the end(not count ending zeroes in the decimal points).
for example, in the above sample, in the whole range the max of count of decimal places is 4 excluding the ending zeroes. so the answer is 4 to be displayed in cell D2
I tried doing regex, but do not know how do I do it for a whole range of values.
Please help!
try:
=INDEX(MAX(LEN(IFERROR(REGEXEXTRACT(TO_TEXT(A2:C4), "(\..+)")*1))-2))
Player0's solution is a good start, but uses TO_TEXT which seems to rely on the formatting of your cells.
If you want to safely compute the number of decimal places, use the TEXT function instead.
TEXT(number, format) requires a format whose max. number of decimal places has to be specified. There is no way around this, because formulas like =1/3 can have infinitely many decimal places.
Therefore, first decide on the max, precision for your use-case (here we use 8). Then use below function which works independently from your document's formatting and language:
=INDEX(MAX(
LEN(REGEXEXTRACT(
TEXT(ABS(A2:C4); "."&REPT("#";8));
"[,.].*$"
))-1
))
We subtract -1 since LEN(REGEXEXTRACT()) also counts the decimal separator (. for english, , for many others) .
Everything after the 8th decimal place is ignored. If all your numbers are something like 123.00000000987 the computed max. is 0. If you prefer it to be 8 instead, then add ROUNDUP( ; 8):
=INDEX(MAX(
LEN(REGEXEXTRACT(
TEXT(ROUNDUP(ABS(A2:C4);8); "."&REPT("#";8));
"[,.].*$"
))-1
))

powerquery: extra digits added to number when importing table

Glad to ask a question here again after more than 10 years (last one was about BASH scripting, now as I'm in corporate, guess what... it's about excel ;) )
here it's my question/issue:
I am importing data with powerquery for further analysis
I have discovered is that the values imported contains extradigits not present in the original table.
I have googled for this problem but I have not been able to find an explanation nor a solution ( a similar issue is this one this one , more than one year old, but with no feedback from Microsoft )
(columns are formatted as text in the screenshot but the issue is still present even if formatted as number)
The workaround I am using now, but I am not happy with that is the following:
I "increased decimal" to make sure all my digits are captured (in my source the entries do not have all the same significant digits),
saved as csv
imported impacted columns as number
convert columns as text (for future text match
I am really annoyed by this unwanted and unpredictable behaviour of excel.
I see a serious issue of data integrity, if we cannot rely on the powerquery/powerbi platform to maintain accurate queries, I wonder why would be use it
adding another screenshot to clarify that changing the source format to text does not solve the problem
another screenshot added following #David Bacci comments:
I think I wrongfully assumed my data was stored as text in the source, can you confirm?
If you are exporting and importing as text, then this will not happen. If you convert to number, you will lose precision. From the docs (my bold):
Represents a 64-bit (eight-byte) floating-point number. It's the most
common number type, and corresponds to numbers as you usually think of
them. Although designed to handle numbers with fractional values, it
also handles whole numbers. The Decimal Number type can handle
negative values from –1.79E +308 through –2.23E –308, 0, and positive
values from 2.23E –308 through 1.79E + 308. For example, numbers like
34, 34.01, and 34.000367063 are valid decimal numbers. The largest
precision that can be represented in a Decimal Number type is 15
digits long. The decimal separator can occur anywhere in the number.
The Decimal Number type corresponds to how Excel stores its numbers.
Note that a binary floating-point number can't represent all numbers
within its supported range with 100% accuracy. Thus, minor differences
in precision might occur when representing certain decimal numbers.
BTW, you should probably accept some of the good answers from your previous questions from 10 years ago.

XSLT - Round up to two decimal places

There is a requirement to round the value up(always) to two decimal places. meaning, the number 8.3333333 should become 8.34. Round and format-number functions do not seem to achieve this. Does anyone have an idea on how to get the desired output using xslt transformation please?
To round up a number with precision of two decimal places:
ceiling(100*$value) div 100
If you need trailing zeros (i.e. a string, not a number) then wrap this in format number().

What is SAS format 8.

I am new to SAS and currently working on a small piece of work with SAS.
Could I please ask what the below format means? I believe the 8. is formatting two digits to the right of the decimal place such as 896.33 but I am not sure. Not really sure what input means.
input(tablename.fieldname, 8.)
That is an INFORMAT, not a FORMAT. It means to read the first 8 characters as a number. If there is a decimal point in the data then it is used naturally. You could have up to 7 digits to the right of the decimal point (since the decimal point would use up the eighth character position). It will also support reading scientific notation so '896.33E2' would mean the number 89,633.

number formatting not working properly,while generating excel report from xsl?

i am converting xsl to excel report . i am not able to render integers as integers with decimal point. Eventhough i use format-number function in xsl. but when i use both
thousand and decimal separator only the numbers with digits greater than 3 are rendered with decimal points...
Example
700 rendered as 700 itself but i want in excel as 700.00
1700 rendered as 1,700.00 when i use comma as thousand separator but when
i use only decimal separator 1700 rendered as 1700 itself...
please help me with valuable answers..
See the specification for the format-number function. The pattern string uses the syntax specified by the JDK 1.1 DecimalFormat class (See the corresponding documentation for JDK 1.4.2).
In particular, 0 is a digit, # is a digit, omitted if zero, while , is the grouping (thousands) separator, and . is the decimal separator.
Seems like you need #,###.00. Some examples:
format-number(700, '#,###.00')
700.00
format-number(1700, '#,###.00')
1,700.00
format-number(1700000, '#,###.00')
1,700,000.00