How to format the negative values in dataflow?

Dhilip Subramanian 41 Reputation points
2022-11-24T08:28:01.673+00:00

Hi

I have below column in my table

263828-image.png

I need an output as below

263770-image.png

I am using Dataflow in the Azure data factory and unable to get the above output. I used derived column but no success. I used replace function, but it's not coming correct. Can anyone advise how to format this in dataflow?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
Community Center | Not monitored
0 comments No comments
{count} votes

Answer accepted by question author
  1. AnnuKumari-MSFT 34,566 Reputation points Microsoft Employee Moderator
    2022-11-25T06:48:38.987+00:00

    Hi @Dhilip Subramanian ,

    Thankyou for using Microsoft Q&A platform and thanks for posting your question here.

    As I understand your requirement, you want to transform the data as mentioned by replacing USD with '$' symbol considering negative and positive values. Please let me know if my understanding is incorrect.

    You can use case statement to achieve this requirement.

    Kindly try this expression in derived column transformation: case(instr(toString(byName('Amount')),'-')!=0,'-$'+rtrim(ltrim(Amount,'-'),'USD'),instr(toString(byName('Amount')),'(')!=0,'-$'+rtrim(ltrim(Amount,'('),') USD'),'$'+rtrim(ltrim(Amount,'-'),'USD'))

    264164-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.