Forum Discussion

cs141005's avatar
cs141005
Regular Visitor
5 years ago
Solved

Column with different data types

Dear all,

 

I would need your support if possible..

Currently within my dataset there is a table "SUM" like below, where columns "Jan" and "Feb" contains both decimal and whole numbers data types.

 
 
 

Is it possible to convert some of the whole number to currency and some other to decimal with 2 decimal places ?

I think that in Power BI a column has only one data type.

 

 

Is there any way to achieve the desired output?

 

Sincerely ,

Mary

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi cs141005 ,

    First of all, all values of one field can only have one data type. If the data type of the field Jan and Feb is Numeric type and later the values in these two fields need to participate in the calculation, it will not be possible to achieve the result you want. If their data type is Text type, you can use FORMAT function to change their data form just as shown in the below screenshot. Please find the details in the attachment.

    Use custom format strings in Power BI Desktop

    Best Regards

2 Replies

  • VijayP's avatar
    VijayP
    Community Champion

    cs141005 

    You can do that using IF and FORMAT Function but you may lose control on calculations

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi cs141005 ,

    First of all, all values of one field can only have one data type. If the data type of the field Jan and Feb is Numeric type and later the values in these two fields need to participate in the calculation, it will not be possible to achieve the result you want. If their data type is Text type, you can use FORMAT function to change their data form just as shown in the below screenshot. Please find the details in the attachment.

    Use custom format strings in Power BI Desktop

    Best Regards