Q: Dynamic Display Units in Visualization I am trying to display the sum of file size using card visualization in Power Bi. The size of files are stored in bytes in database.
as the number of files are huge the total accumulation of size showed the data in million bytes.
I would like to know that is it possible to dynamically display the data in byte,MegaByte and Gigabyte or Terabyte as the some of file size cross the conversion parameter.
Regards
To solve the problem i created a calculated column and converted the bytes into Megabyte and used the same in visualization. but the as the data is growing daily. The sum of file size is again showing data in million of MB
DAX Used to create calculated Column:
Size(Mb) = (1e-6*Data[size])
Example:
if the sum of file size is less than 1024 the Card should display the size in bytes, if the sum grows more than 1024 it should display the size in Kilo bytes and if the sum grows more than 1024*1024 the display size should be in MB and so on.

A: You can create a measure which formats the File Size appropriately:
File Size = 
VAR     SizeBytes = SUM ( xlDev[Attributes.Size] )
VAR     NumberFormat = "#,##0.00 "
VAR     NumberBase = 1024
VAR     Suffix = 
            SWITCH ( 
                NumberBase,
                1024, "iB",
                1000,"B",
                BLANK()
            ) 
RETURN
    SWITCH (
        TRUE(),
        SizeBytes >= POWER ( NumberBase, 8 ), FORMAT( SizeBytes / POWER ( NumberBase, 7 ), NumberFormat ) & "Y" & Suffix,
        SizeBytes >= POWER ( NumberBase, 7 ), FORMAT( SizeBytes / POWER ( NumberBase, 7 ), NumberFormat ) & "Z" & Suffix,
        SizeBytes >= POWER ( NumberBase, 6 ), FORMAT( SizeBytes / POWER ( NumberBase, 6 ), NumberFormat ) & "E" & Suffix,
        SizeBytes >= POWER ( NumberBase, 5 ), FORMAT( SizeBytes / POWER ( NumberBase, 5 ), NumberFormat ) & "P" & Suffix,
        SizeBytes >= POWER ( NumberBase, 4 ), FORMAT( SizeBytes / POWER ( NumberBase, 4 ), NumberFormat ) & "T" & Suffix,
        SizeBytes >= POWER ( NumberBase, 3 ), FORMAT( SizeBytes / POWER ( NumberBase, 3 ), NumberFormat ) & "G" & Suffix,
        SizeBytes >= POWER ( NumberBase, 2 ), FORMAT( SizeBytes / POWER ( NumberBase, 2 ), NumberFormat ) & "M" & Suffix,
        SizeBytes >= POWER ( NumberBase, 1 ), FORMAT( SizeBytes / POWER ( NumberBase, 1 ), NumberFormat ) & "K" & Suffix,
        FORMAT( SizeBytes, NumberFormat ) & "B"
    )


A:  kbytes_display = 
                    VAR Kilo = 
                        SUM ( fact_matrix[kbytes] )
                    RETURN 
                        SWITCH (
                            TRUE (),
                                 ABS ( Kilo ) > 2 ^ 50, FORMAT ( DIVIDE ( Kilo, 2 ^ 50 ), "###.00 Eb" ), 
                                 ABS ( Kilo ) > 2 ^ 40, FORMAT ( DIVIDE ( Kilo, 2 ^ 40 ), "###.00 Pb" ), 
                                 ABS ( Kilo ) > 2 ^ 30, FORMAT ( DIVIDE ( Kilo, 2 ^ 30 ), "###.00 Tb" ), 
                                 ABS ( Kilo ) > 2 ^ 20, FORMAT ( DIVIDE ( Kilo, 2 ^ 20 ), "###.00 Gb" ), 
                                 ABS ( Kilo ) > 2 ^ 10, FORMAT ( DIVIDE ( Kilo, 2 ^ 10 ), "###.00 Mb" ),
                                 IF ( ABS ( Kilo ) <> BLANK (), FORMAT ( Kilo, "### Kb" ), BLANK ()) 
                                 )

