Forum Discussion
Calculated row/cell in Power BI
- 7 years ago
Hi eamclaughlin,
Based on my test, you could refer to below steps:
Sample data:
Create four calculated columns in Table2:
FY1 = IF('Table2'[Performence]="Task 1",CALCULATE(SUM(Table1[FY18]))) FY2 = IF('Table2'[Performence]="Task 1",CALCULATE(SUM(Table1[FY19]))) FY3 = IF('Table2'[Performence]="Task 1",CALCULATE(SUM(Table1[FY20]))) FY4 = IF('Table2'[Performence]="Task 1",CALCULATE(SUM(Table1[FY21])))Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
Hi v-danhe-msft
Thank you very much for the help with this!! I was trying this method although using measures which didn't work so thanks for helping me with that error.
One other question as an add on - Using your equation for calculated columns, Am I able to insert an OR statement in to that to calculate 2 rows of data?
e.g IF(Performance = Task1 OR Task 2, SUM(FY18))
I am would be looking to use this to calculate 3 rows out of 50 although the equation is the same within each row. I have tried the below equation but it hasn't worked;
FY1 = IF(OR('Table2'[Performence]="Task 1",'Table2'[Performence]="Task 2"),CALCULATE(SUM(Table1[FY18])))I receive the below error;
The syntax for ')' is incorrect. (DAX(IF(OR('Table2'[Performence]="Task 1",'Table2'[Performence]="Task 2"),CALCULATE(SUM(Table1[FY18]))).