Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

New column as sum of two columns from ellements in different rows

Hello,

 

this requirement is kind of hard to explain but I will give my best to illustate it.

 

I do have two tables:

1) Table A with two columns: (i) Column Index which is basicaly a unique integer and (ii) column Size which is a decimal number. Table A has 100 rows. Index goes from 100 to 200.

2) Table B with two columns: (1) Column Index which is basicaly a unique integer and (ii) column Size which is a decimal number. Table B has 300 rows. Index goes from 1-300.

 

I want to create a calculated column in Table A Total that each row (k) will be the result of A.Size(k)+B.Size(k+z) where z is an integer between -50 and 50.

 

Is this somehow possible via a calculated column either in the query or in the report level? idealy the z should be selectable via a visualization but this is not a must.

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Anonymous,

Create a measure instead of column in the table A.

Total = SUM(TableA[Size])+CALCULATE(SUM(TableB[Size]),FILTER(TableB,TableB[Index]=MAX(TableA[Index])+MAX(TableZ[z])))

1.JPG2.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuezhe-msft
Employee
Employee

@Anonymous,

Create a measure instead of column in the table A.

Total = SUM(TableA[Size])+CALCULATE(SUM(TableB[Size]),FILTER(TableB,TableB[Index]=MAX(TableA[Index])+MAX(TableZ[z])))

1.JPG2.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I am trying to understand why it works but I cant. I need to understand what exactly the measure does. It is awesome though befcause even if it reached the boundaries it does what I wanted it to do!

 

Just to help others in the future it can be used to "move" plots left and right. Thank you @v-yuezhe-msft!

move graph.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.