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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
GertjanBoersma
Frequent Visitor

calculated column row subtotals

Hi, 

 

I've  created a calculated column (combined kg) with the following DAX code:

 

Combined kg =
IF(Sheet1[Department] = "A",
Sheet1[planned KG],
CALCULATE(SUM(Sheet1[planned KG]), FILTER(Sheet1, Sheet1[Department] = "B" && Sheet1[Contract + line] = "123456 789")) -
CALCULATE(SUM(Sheet1[planned KG]), FILTER(Sheet1, Sheet1[Department]= "A" && Sheet1[Contract + line] = "123456 789"))
)
 
it gives me the result presented in the table:

GertjanBoersma_1-1617710089549.png

 

for this contract the dax code works perfectly but for the whole table i need a dynamic filter on  "contract + line"

Can anyone help me?

Context  info: The main contract is given by department B. If department A gives a vendor an underlying contract the number of kilo's is reduced on contract from department B. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @GertjanBoersma ,
Check out these links it may help you.
Link 1 
Link 2 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello @GertjanBoersma 
If I get you correctly you want to change the "Contract + Line" value dynamically as per filter selection?
If yes you can use the SELECTEDVALUE in measure.
Please let me know if you're expecting something else.

Hello @Anonymous, 

It's not used for a measure but for a calculated column. In my table i have multible contract from different contracts. that's why i need a dynamic filter on contract+line and department. 

If i use the SELECTEDVALUE after the && operator an error accured.  Can  you show me the dax code?

 

gr

Anonymous
Not applicable

Hello @GertjanBoersma ,
Check out these links it may help you.
Link 1 
Link 2 

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.