Formatting Numeric Values within CONCAT functions to Currency

Hi there!

In one of my graphs, I have created a few beast modes involving nested CONCAT functions so I can capture many fields in a hover text. Some of the fields in the CONCAT are numeric but I would like them displayed as currency. After running the beast modes, the numbers are displayed as a long integer with no thousand separator etc. I understand that using my quantitative fields in this way means that I cannot use the 'Display as' format option in the Analyzer. I was wondering if there is something I can do prior to the Beast Mode CONCAT, such as an ETL node or mySQL code?



Best Answer

  • MarkSnodgrass
    MarkSnodgrass Portland, Oregon 🟤
    Accepted Answer

    I recommend formatting it to currency with the concat function in a beast mode. If you try and do it in an ETL, then they would become strings and the card wouldn't be able to sum them when a user is interacting with the card. Here is a beast mode that will format it for you and abbreviate the millions and thousands:

      (CASE       WHEN INSTR(SUM(`totalreported`),'.') = 10 THEN /*xxx million*/ 
           WHEN INSTR(SUM(`totalreported`),'.') = 9 THEN /*xx million*/ 
           WHEN INSTR(SUM(`totalreported`),'.') = 8 THEN /*x million*/ 
           WHEN INSTR(SUM(`totalreported`),'.') = 7 THEN /*xxx thousand*/ 
           WHEN INSTR(SUM(`totalreported`),'.') = 6 THEN /*xx thousand*/ 
           WHEN INSTR(SUM(`totalreported`),'.') = 5 THEN /*x thousand*/ 

    Here are two other examples of how to do it.