Forum Discussion

adityavighne's avatar
adityavighne
Continued Contributor
6 years ago

Add target column to calculated table

Hi,

 

I have calculated column and I want to add target for that and get difference value. How can I do this.

 

Name,Open,Close and total is calculated table and Target, Difeerence column I want to add

 

NameOpenCloseTotalTargetDifference

A

1020305020
B56116049
C20507010030

 

How can I add this and display.

 

Regards,

Aditya Vighne

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    You have targets for each "Name" in a different table which you want to bring in this calculated table or you want to add the values by hard-coding them in the DAX and add it here?

    • adityavighne's avatar
      adityavighne
      Continued Contributor

      Anonymous  

      I want to add target for each by hard coding.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi,

         

        You can use SWITCH statement to list target as 50 for A , 100 for B , 150 for C etc. SWITCH ("ColumnA","A",50,"B",100,"C",150,0)

         

        Regards

        Rohit

  • Hi,

    Create a seperate 2 column Table with Names in column A and targets in column B.  Create a relationship from the Names in your existing table to the Names in the new 2 column table.  In your existing table, write these calculated column formulas:

    Targets = related(table1[Target])

    Difference = [targets]-[total]

    Hope this helps.

  • Icey's avatar
    Icey
    Community Support

    Hi adityavighne ,

     

    Is this problem solved?


    If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


    If not, please let me know.

     


    Best Regards,
    Icey

      • AllisonKennedy's avatar
        AllisonKennedy
        Community Champion
        Please can you provide further detail then on what hasn't worked about the suggested solutions?
  • Icey's avatar
    Icey
    Community Support

    Hi adityavighne ,

     

    Please provide more details to help us understand what you want.

     

     

    Best Regards,

    Icey