March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have used the below code to create a formula to convert Bytes into KB, MB, GB, TB. The calculation seems to be right but when we are validating the size between Azure cloud and Power BI there is slight difference in size.
For example:
I have one file size 49106756748 bytes, when it is converted to GB , it shows 45.73GB in Power BI where as Azure shows 49.16GB.
After doing google search, the size shown as 45.73 GB is Gibibytes where as 49.16 GB is the right Gigbyte size.
I am not sure how to change the calculation to show GB value nstead of Gibibyte value in Power BI. The current formula used is:
The reason for the discrepancy in the size representation between Power BI and Azure is due to the difference between "Gigabytes" (GB) and "Gibibytes" (GiB). Power BI's formatting is using "Gibibytes" (GiB), which is based on the binary system, while Azure might be using "Gigabytes" (GB), which is based on the decimal system. 1 GB is typically defined as 1,000,000,000 bytes, while 1 GiB is defined as 1,073,741,824 bytes.
If you want to display the size in "Gigabytes" (GB) as Azure does, you can modify your DAX formula to accommodate the decimal-based definition of a gigabyte. Here's an adjusted version of your formula:
```DAX
Size =
VAR total = SUM(Query1[Size of Data]) + 0
RETURN
IF (
total < 1024,
FORMAT(total, "#0.0# B"),
IF (
total < 1000000000, -- Check if the size is less than 1 GB (decimal)
FORMAT(total / 1024, "#0.0# KB"),
IF (
total < 1000000000 * 1000, -- Check if the size is less than 1 TB (decimal)
FORMAT(total / 1000000000, "#0.0# GB"),
FORMAT(total / (1000000000 * 1000), "#0.0# TB")
)
)
)
```
This modified formula uses decimal-based divisions to calculate the size in GB and TB. It should align more closely with the representation you see in Azure, which is typically based on decimal gigabytes and terabytes.
@Alef_Ricardo_ sorry for the late reply. I used this logic but for MB value I am getting 00.0000KB as there is no condition for MB, so I modified the logic to:
Also I get TB also 00000.00000TB (EX: 13903384.45TB).
Can you help me with this? I am new to PowerBI.
@rajiramk Change 1024 to 1000? GB Vs GiB: What’s The Difference? - MASV (massive.io)
Thank you Greg for the help. sorry for the dealy reply.
Thanks for your reply. I tried to change , it did not help. I got the same (45.73 GB)
@rajiramk Oh, duh, you need to modify your POWER statements as well. GiB is based on powers of 2^10 = 1024. GB is based on powers of 10, 10^3 = 1000.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |