Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

measure with if statement formatting

Hello all,

 

I've made an IF statement in a measure to have the user select the data ina visual. This can be Orders or Turnover. It looks something like this:

Jobs/Revenue slicer =
IF(
    SELECTEDVALUE('Table'[Type]) = "Orders",
    [Amount of orders],
    IF(
        SELECTEDVALUE('Table'[Type]) = "Turnover",
        [Total turnover]))

However, The outcome will also be presented in a table, where the user must be able to sort the data, so the values must be numbers. As the turnover is financial data, I need two decimals and a seperator for the thousands etc. The orders are whole numbers. 

I cannot have this outcome in the visuals, as the orders will also be placed with decimals. 

Is there a way to have this corrected?
Thank you in advance!

4 Replies

  • Rena's avatar
    Rena
    Icon for Resolver II rankResolver II

    Did you try wrapping it in a format?

     

    Example:

     

    Jobs/Revenue slicer =
    IF(
        SELECTEDVALUE('Table'[Type]) = "Orders",
        FORMAT([Amount of orders],"0.0"),
        IF(
            SELECTEDVALUE('Table'[Type]) = "Turnover",
            FORMAT([Total turnover]),"0.00"))
    • Rena's avatar
      Rena
      Icon for Resolver II rankResolver II

      It didn't come out well in the example above but one of the formats should be 0,0 (with a comma) and the other should be 0.00 (with a period).  I might have mistyped one...

      • Anonymous's avatar
        Anonymous
        Not applicable

        Thank you for the answer, 
        The problem is, when this is done this way, that the outcome will be placed in TEXT, therefore the user will not be able to sort anymore..