Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Fomat & Currency

So I have this code

Moneda Seleccionada =
VAR CAMBIO = SELECTEDVALUE(Hoja4[SIGLAS])
RETURN
IF(CAMBIO="USD", FORMAT([TOTAL USD],"$ #.##"),
IF(CAMBIO="PE", FORMAT([TOTAL SOLES],"PE #.##"),
FORMAT([TOTAL REALES],"R$ #,##")))
But I would like to have  "S/ #,##" format for Peru. I see that S/ is the currency symbol displated when I chage the data type within the format tab. However it does not work when I write it inside format function
 
Thanks for your help!!
 
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

    According to my understanding, you want to format currency with “S/” , right?

    For my test,once format() is used, the type of the data will become String, then you can add "S/"&" "& before format() like this:

    Moneda Seleccionada =
    VAR CAMBIO =
        SELECTEDVALUE ( Hoja4[SIGLAS] )
    RETURN
        IF (
            CAMBIO = "USD",
            FORMAT ( [TOTAL USD], "$ #.##" ),
            IF (
                CAMBIO = "PE",
                "S/" & " "
                    & FORMAT ( [TOTAL SOLES], "#.##" ),
                FORMAT ( [TOTAL REALES], "R$ #,##" )
            )
        )

    My visualization looks like this:

    Is the result what you want? If you have any questions, please upload some data samples and expected output.

    Please do mask sensitive data before uploading.

     

    Best Regards,

    Eyelyn Qin

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    According to my understanding, you want to format currency with “S/” , right?

    For my test,once format() is used, the type of the data will become String, then you can add "S/"&" "& before format() like this:

    Moneda Seleccionada =
    VAR CAMBIO =
        SELECTEDVALUE ( Hoja4[SIGLAS] )
    RETURN
        IF (
            CAMBIO = "USD",
            FORMAT ( [TOTAL USD], "$ #.##" ),
            IF (
                CAMBIO = "PE",
                "S/" & " "
                    & FORMAT ( [TOTAL SOLES], "#.##" ),
                FORMAT ( [TOTAL REALES], "R$ #,##" )
            )
        )

    My visualization looks like this:

    Is the result what you want? If you have any questions, please upload some data samples and expected output.

    Please do mask sensitive data before uploading.

     

    Best Regards,

    Eyelyn Qin

    • Anonymous's avatar
      Anonymous
      Not applicable
      I copied it but didnt work T_T