Forum Discussion

FilipK's avatar
FilipK
Icon for Resolver I rankResolver I
5 years ago
Solved

Typecasting and Accuracy for index columns

I figured out, that an index I calculate in SQL is somehow changed in PBI and wonder why.   While in SQL I'm receiving 1115455083172412 as a result of:   SELECT CAST( ( 28996...
  • FilipK's avatar
    5 years ago

    I think it has todo with IEEE 754. I found this Last digits are changed to zeros when you type long numbers in cells of Excel - Office | Microsoft Docs

     

    By converting it in SQL to varchar(16) it works. Initially I wanted to create unique ids that are numeric instead of varchar to save some space and to get a faster report. I'll open another thread for this.

    SELECT CAST(CAST(
            (
                28996 + MAX(1625083514252 - 1577880000000) / 1000
            ) * (
                28996 + MAX(1625083514252 - 1577880000000) / 1000 + 1
            ) / 2 + MAX(1625083514252 - 1577880000000) / 1000 AS numeric
        ) AS VARCHAR(16)) AS configId1