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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Saray_kh
Frequent Visitor

Calculate price by iterating through rows

Hello Colleagues!
I have been trying for a few days to extract the price per package and there is no way. I put you in context to see if you can help me.

I have the following table where I have a price per package and a price per package content. I need to calculate the price by subtracting all the content prices that contain an X in the comparison data column.

Saray_kh_0-1686153006501.png

In the example I show I need to be able to do the following calculation:
1083-0-376-490 = 217€ (I need this value for each row that contains PCE as a package)
Could you tell me how to do it?

Thank you very much in advance.

2 REPLIES 2
Anonymous
Not applicable

Hi @Saray_kh ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure.

Measure = 
var _a= MAX('Table'[Package price])
var _b= CALCULATE(SUM('Table'[Content price]),FILTER(ALL('Table'),'Table'[Package]=MAX('Table'[Package]) && 'Table'[Comparision Data]="X"))
return _a-_b

(3) Then the result is as follows.

vtangjiemsft_0-1686277014240.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Hi Nekko! Thank u for your response.

It didnt work for me, but I finally could achieve it by creating a unique table with package and price, and then calculate a dax mesure. 

 

Best Regards,

 

Saray.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors