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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
TomerIwanir1
Helper I
Helper I

% calculation per row

Hello

I'm trying to create a calculate column of cost % out of total cost with filters, attaching the pic below for example 

I have two column that filtering my calc, the right column (cost %) is what im trying to create, please note that I have a lot of month and products so creating a measure oer each one is not relevent.

 

thx again !

 

TomerIwanir1_0-1727074282642.png

 

1 ACCEPTED SOLUTION

@TomerIwanir1 

 

I think you forgot to write "Filter". so write it as follows:

Product_Share = 'Sales'[Total Cost (Calc)] / CALCULATE(SUM('Sales'[Total Cost (Calc)]),Filter ('Sales','Sales'[Month] = EARLIER('Sales'[Month]) && 'Sales'[Product_Group (Calc)] = EARLIER('Sales'[Product_Group (Calc)]))

 

* I highlight updated part*

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

View solution in original post

6 REPLIES 6
TomerIwanir1
Helper I
Helper I

I'm getting all 100 %

Product_Share = 'Sales'[Total Cost (Calc)] / CALCULATE(SUM('Sales'[Total Cost (Calc)]),'Sales'[Month] = EARLIER('Sales'[Month]),'Sales'[Product_Group (Calc)] = EARLIER('Sales'[Product_Group (Calc)]))
 
where cost is a decimal number,month is a date and product is text

@TomerIwanir1 

Are you sure that you have written a column , and not measure??

I think so, pls see below :

 

TomerIwanir1_0-1727090991415.png

 

@TomerIwanir1 

 

I think you forgot to write "Filter". so write it as follows:

Product_Share = 'Sales'[Total Cost (Calc)] / CALCULATE(SUM('Sales'[Total Cost (Calc)]),Filter ('Sales','Sales'[Month] = EARLIER('Sales'[Month]) && 'Sales'[Product_Group (Calc)] = EARLIER('Sales'[Product_Group (Calc)]))

 

* I highlight updated part*

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

Yes ! I changed the "," into "&&" at the filter:
 
product_Share = 'Sales'[Total Cost (Calc)] / CALCULATE(SUM('Sales'[Total Cost (Calc)]),FILTER(Sales,Sales[Month] = EARLIER(Sales[Month])&& Sales[Product_Group (Calc)] = EARLIER(Sales[Product_Group (Calc)])))
 
 
thank you !
Selva-Salimi
Super User
Super User

Hi @TomerIwanir1 

You can write a column as follows and change the format as percentage:

 

Product_Share := Cost / calculate(sum(cost) , filter (your_table , period= earlier (period) && product= earlier (product))

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.