Forum Discussion
adityavighne
Continued Contributor
6 years agoAdd 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 ...
adityavighne
Continued Contributor
6 years agoAnonymous
I want to add target for each by hard coding.
AllisonKennedy
Community Champion
6 years agoadityavighne I think creating a table as Anonymous suggested and loading that into the Data Model would be a better solution, but you could use a Switch or IF to hard code this using ADDCOLUMNS or similar table constructor:
NewTable= ADDCOLUMNS(CalculatedTable, "Target", SWITCH(CalculatedTable[Name], "A", 50, "B", 60, "C", 100)
The difference can be added as a Calculated column or added into that table expression.
See this solution from v-lili6-msft for what we mean by having the target table stored in the data model and how to set that up with relationships (in your case replace 'year' with 'name')
https://community.powerbi.com/t5/Desktop/Adding-annual-target-to-existing-table/td-p/579550
NewTable= ADDCOLUMNS(CalculatedTable, "Target", SWITCH(CalculatedTable[Name], "A", 50, "B", 60, "C", 100)
The difference can be added as a Calculated column or added into that table expression.
See this solution from v-lili6-msft for what we mean by having the target table stored in the data model and how to set that up with relationships (in your case replace 'year' with 'name')
https://community.powerbi.com/t5/Desktop/Adding-annual-target-to-existing-table/td-p/579550