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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Calculate budget with condition in the other table

Hi

Hi all,

 

I am creating a measure to calculate the budegt, I need to use the condition which is Budget Amount =0 in Level 8 table, but the result is wrong. I am thinking probably the relation between Level 8 and Level 9 is many to many and both direction causes the error.

Cost without Budget = CALCULATE(SUM('Account Ledger (Level 9)'[Cost to Date]),  'Account Master (Level 8)'[Revised Budget Amount] = 0)

 

I really need help to figure it out.

 

Thank you in advance!

 

 

babyjb123_0-1657062345086.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your statement, I think there should be multiple [Revised Budget Amount] for same keycolumn in Account Master (Level 8). Keycolumn should be the column which we are using to connect "Account Master (Level 8)" and "Account Ledger (Level 9)". 

Try this code to create a measure.

Measure = 
CALCULATE(
SUM('Account Ledger (Level 9)'[Cost to Date]),
FILTER(ALL('Account Ledger (Level 9)'),
CALCULATE(SUM('Account Master (Level 8)'[Revised Budget Amount]),FILTER(ALL('Account Master (Level 8)'),'Account Master (Level 8)'[Keycolumn] = MAX('Account Ledger (Level 9)'[keycolumn]))) = 0)
)

Here is my sample.

RicoZhou_1-1657526457474.png

RicoZhou_2-1657526465026.png

RicoZhou_0-1657526450022.png

Result is as below.

RicoZhou_3-1657526476307.png

 

Best Regards,
Rico Zhou

 

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
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your statement, I think there should be multiple [Revised Budget Amount] for same keycolumn in Account Master (Level 8). Keycolumn should be the column which we are using to connect "Account Master (Level 8)" and "Account Ledger (Level 9)". 

Try this code to create a measure.

Measure = 
CALCULATE(
SUM('Account Ledger (Level 9)'[Cost to Date]),
FILTER(ALL('Account Ledger (Level 9)'),
CALCULATE(SUM('Account Master (Level 8)'[Revised Budget Amount]),FILTER(ALL('Account Master (Level 8)'),'Account Master (Level 8)'[Keycolumn] = MAX('Account Ledger (Level 9)'[keycolumn]))) = 0)
)

Here is my sample.

RicoZhou_1-1657526457474.png

RicoZhou_2-1657526465026.png

RicoZhou_0-1657526450022.png

Result is as below.

RicoZhou_3-1657526476307.png

 

Best Regards,
Rico Zhou

 

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

@Anonymous ,what error it is giving

 

Try like

Cost without Budget = CALCULATE(SUM('Account Ledger (Level 9)'[Cost to Date]),Filter( 'Account Master (Level 8)',  'Account Master (Level 8)'[Revised Budget Amount] = 0) )

 

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.