Forum Discussion

apradh6's avatar
apradh6
Frequent Visitor
6 years ago

Handle formatting with multiple data type in same column

Hi, 

My data has a column which has both the count and dollar amounts. Is it possible to preserve this in a table in power bi? I want to show the dollar amount in currency format and count in decimal. I prefer not to separate them out in different columns as there are multiple categories of counts and currencies. 

 

Activity                                Activity Progress

Activity 1 Count                               5

Activity 1 Dollar                             $100

Activity 2 Count                               10

Activity 2 Dollar                            $1000

 

Thanks!

5 Replies

  • Kumail's avatar
    Kumail
    Impactful Individual

    Hello apradh6 

     

    Hope the below measure helps.

     

    FormatDataType =
    VAR Val = SUM ( 'Table'[Activity Progress] )
    RETURN
    SWITCH (
    SELECTEDVALUE ( 'Table'[DataType] ),
    "Dollar", FORMAT ( Val, "$0" ),
    "WholeNumb", FORMAT ( Val, "0.00" )
     
    If you have any other queries, you can send the sample .pbix file by adding it to your drive or dropbox and add the link here. 
     
    Regards
    Kumail Raza
    Did this help? Kudos are appreciated.
    Consider Accept it as the solution to help the other members find it more quickly.
  • Hi. If I understood you will be able to do this with measures. First you need a column to identify when is it a dollar value and when is it a count value. If you have that, you can create a measure like:

    Money = 
    CALCULATE (
        Table[Activity Progress] ,
        Table[ColumnToIdentify] = "Dollar"
    )

    Then change the format to that particular Measure. Add a new measure for Activity count and format it as you want.

     

    Hope this helps,

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

    • apradh6's avatar
      apradh6
      Frequent Visitor

      Hi ibarrau,

      The data is in an excel file (sample below) and when I use Get data to import it to PowerBi it changes everything to a single format. I am not sure about your response before. Can you elaborate? I am new to Power BI and I apologize if I sound like an amateur. I want to show it similar to the file in a "Table" visualization with the correct formatting.