cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
nicolasvc
Helper III
Helper III

Get data from another column and function earlier

I have a table like the following one in which I use the earlier function to calculate the sum of each product, but now I have another table in which I have a percentage, and this value I need to multiply by each row of the sum column, how can I get That value being that I am already using the function earlier and such that it matches the Store and Product column?

 

sum = calculate (sum ('A' [price])) , FILTER ('A', [index] <= EARLIER ('A' [index]) && [store] = EARLIER ('A' [store]) ))

 

index Store YearMonth Product price sum
1120211A80008000
2120212B10009000
3120213C500014000

 

Other table

 

Store Product Percentage
1A0.9
1B0.5
1C0.3
1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @nicolasvc

You can try the following methods:

1. I have prepared tables a and B first. Sum is the calculation column.

vzhangti_0-1634804941084.png2. Use the LOOKUPVALUE function to match the sum column of table A to table B.

Sum =
LOOKUPVALUE ( A[Sum], A[ Store], [Store], A[ Product], [ Product] )

vzhangti_1-1634805033059.png

3. The value you want is shown in the figure:

Value = B[Sum]*B[ Percentage]

vzhangti_2-1634805102417.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

Best Regards,

Charlotte 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-zhangti
Community Support
Community Support

Hi, @nicolasvc

You can try the following methods:

1. I have prepared tables a and B first. Sum is the calculation column.

vzhangti_0-1634804941084.png2. Use the LOOKUPVALUE function to match the sum column of table A to table B.

Sum =
LOOKUPVALUE ( A[Sum], A[ Store], [Store], A[ Product], [ Product] )

vzhangti_1-1634805033059.png

3. The value you want is shown in the figure:

Value = B[Sum]*B[ Percentage]

vzhangti_2-1634805102417.png

If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

Best Regards,

Charlotte Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@nicolasvc , Use MAxx if needed

 

% = sumX (FILTER ('B', 'A'[index] <= ('B' [index]) && 'A'[store] = ('B' [store]) ), 'B' [Percentage])

 

or

 

% = MAXX(FILTER ('B', 'A'[index] <= ('B' [index]) && 'A'[store] = ('B' [store]) ), 'B' [Percentage])

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors