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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Summation for Different Data Types in same Column !

Hi,

 

I am looking for the DAX function to calculate the column to make unique to get correct sum figure while preparing the visualization.

 

I need to prepare based on the the month total_data summation. Before that i need to convert the data into GB all of Data Type. Please suggest how to convert the data using the DAX , so that we can sum the Total_Data.

 

Formated YearData_typeTotal_data
Apr-19 B21285
Apr-19B0
Apr-19GB909866.69
Apr-19KB248615.01
Apr-19MB58876.97
Apr-19TB39519.41
Aug-19 B73742
Aug-19B0
Aug-19GB1147168.81
Aug-19KB6033.27
Aug-19MB74900.88
Aug-19TB28773.93
Dec-19 B73507
Dec-19B0
Dec-19GB152571.36
Dec-19KB14228.56
Dec-19MB135740.53
Dec-19TB25513.71
Feb-19 B73143
Feb-19B0
Feb-19GB370056.91
Feb-19KB

100.2

 

Please suggest.

 

Thanks,
Venugs

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

Try creating new column like

GB Value =
SWITCH (
        TRUE (),
        [Data_type] = "MB", Total_data/1024,
        [Data_type] = "KB", Total_data/1024/1024,
        [Data_type] = "TB",Total_data*1024,
        Total_data
    )

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on my description, you may create a calculated column as follows.

 

GB column 1 = 
IF(
    'Table'[Date_type] = "B",
    'Table'[Total_data]/1024/1024/1024,
    IF(
        'Table'[Date_type] = "KB",
        'Table'[Total_data]/1024/1024,
        IF(
            'Table'[Date_type] = "MB",
            'Table'[Total_data]/1024,
            IF(
                'Table'[Date_type] = "GB",
                'Table'[Total_data],
                IF(
                    'Table'[Date_type] = "TB",
                    'Table'[Total_data]*1024
                )
            )
        )
    )
)

OR

GB column 2 = 
SWITCH(
    TRUE(),
    'Table'[Date_type] = "B",'Table'[Total_data]/1024/1024/1024,
    'Table'[Date_type] = "KB",'Table'[Total_data]/1024/1024,
    'Table'[Date_type] = "MB",'Table'[Total_data]/1024,
    'Table'[Date_type] = "GB",'Table'[Total_data],
    'Table'[Date_type] = "TB",'Table'[Total_data]*1024,
    BLANK()
)

 

 

Then you could create a measure as below.

 

SumTotalData = 
CALCULATE(
    SUM('Table'[GB column 1]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Formated Year] = MAX('Table'[Formated Year])
    )
)

 

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on my description, you may create a calculated column as follows.

 

GB column 1 = 
IF(
    'Table'[Date_type] = "B",
    'Table'[Total_data]/1024/1024/1024,
    IF(
        'Table'[Date_type] = "KB",
        'Table'[Total_data]/1024/1024,
        IF(
            'Table'[Date_type] = "MB",
            'Table'[Total_data]/1024,
            IF(
                'Table'[Date_type] = "GB",
                'Table'[Total_data],
                IF(
                    'Table'[Date_type] = "TB",
                    'Table'[Total_data]*1024
                )
            )
        )
    )
)

OR

GB column 2 = 
SWITCH(
    TRUE(),
    'Table'[Date_type] = "B",'Table'[Total_data]/1024/1024/1024,
    'Table'[Date_type] = "KB",'Table'[Total_data]/1024/1024,
    'Table'[Date_type] = "MB",'Table'[Total_data]/1024,
    'Table'[Date_type] = "GB",'Table'[Total_data],
    'Table'[Date_type] = "TB",'Table'[Total_data]*1024,
    BLANK()
)

 

 

Then you could create a measure as below.

 

SumTotalData = 
CALCULATE(
    SUM('Table'[GB column 1]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Formated Year] = MAX('Table'[Formated Year])
    )
)

 

 

Result:

d2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

Try creating new column like

GB Value =
SWITCH (
        TRUE (),
        [Data_type] = "MB", Total_data/1024,
        [Data_type] = "KB", Total_data/1024/1024,
        [Data_type] = "TB",Total_data*1024,
        Total_data
    )

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors