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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
LadyCat
Frequent Visitor

Two Columns and Multiplication in a Matrix?

Hello, 

 

I need help with the following, which I have been battling with for some time. 

I basically have data that looks like this: 

LadyCat_0-1683619616576.png

 

The rows in yellow are the most recent transactions per product and customer ID that I need to display in a matrix. So far, I have been able to do this and it is giving me what I need: 

 

LadyCat_1-1683619720086.png

 
The code that I am using for this is :
 
Latest =
VAR LatestDateOfData =
CALCULATE(
MAX(Data[Reporting Date]),
FILTER(Data,Data[Customer ID])
)
RETURN
CALCULATE(SUMX(Data, Data[Value]), FILTER(Data, Data[Reporting Date]=LatestDateOfData)
)
 
And - 
LatestData =
VAR TempTable = SUMMARIZE(Data,Data[Customer ID],"ValueLatest",'Key Measures'[Latest])
RETURN
IF(HASONEVALUE(Data[Value]),'Key Measures'[Latest],SUMX(TempTable,[ValueLatest]))
 

The problem is that I would like to add next to each product the costs displayed in the Excel sheet above and then multiply each value * costs% in a new column. These costs change every reporting period so that there can be several lines for each product and customer. But when I try to pull up the costs column into a visual, Power BI returns all the costs that are in the data model and the total is wrong. So for example, for customer 22 I am getting the following: 

 

LadyCat_2-1683620120817.png

 

Instead of just this: 

LadyCat_3-1683620192418.png

Next I would like to display 280.488 * 1,73% = 4852,44. 

 

Is there any way I can do this? I tried to create a summary table with two columns - value and costs - but it is not working (otherwise I wouldn't be here).

 

Thank you for your help.

 

 

3 REPLIES 3
devanshi
Helper V
Helper V

Valueproducts=
VAR t1='DATA'[CutomerID]
VAR t2='DATA'[Product Number]

VAR t3='DATA'[CutomerID]

FILTER(LatestDate=MAX[ReportingDate] && t1=t3,t2)

RETURN

SUMX(SUMMARIZE(DATA[Value],FILTER(DATA[LatestDate], DATA[Value]*DATA[Costs])))

Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26Rh31YoZm1PBIRbZu_?e=FBlms6

Screen Capture #1079.pngScreen Capture #1080.pngScreen Capture #1081.pngScreen Capture #1082.png

Thank you so much for this, it works ! 

 

I have another question if you don't mind? How would you handle having the same product reported on the same day but with different amounts and with different costs? I mean the following - 

LadyCat_0-1684313153109.png

Many thanks

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors