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
pagliaci
Frequent Visitor

Compare multiple values against target budget

 Hello, 

 

I have a powerbi where it shows me a report for the total $ spent in the departments, the database is the $ of each product bought, where I have a card that shows me the total amount and a table like this:

pagliaci_0-1659541702540.png

 

And I want to compare that with the target for the month for example:

pagliaci_1-1659541755688.png

 

My final result should be showing if the amount spent is within the target. I am having trouble to do this because my expenses are dynamic and my target is fixed, so when I try to put in a table together it keeps doing the avarage or sum. Does anyone have an idea on how to do it?

 

Thank you

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @pagliaci ,

 

According to the code, I think you don't need to create a relationship between target table and expense table. We have added the filter in code.

 

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

4 REPLIES 4
RicoZhou2
Resolver I
Resolver I

Hi @pagliaci ,

 

If your "Expense" table is as below, you can try to Unpivot [Target for Month] columns in "Targer" table in Power Query Editor.

RicoZhou2_1-1660031446955.png

New Table:

RicoZhou2_0-1660031318418.png

Then your calculation will be much easier.

M_Expense = 
CALCULATE(SUM(Expense[Expense]),FILTER(ALL(Expense),Expense[Department] = MAX(Target[Department])&& Expense[Month] in VALUES(Target[Month]))) 
Measure = IF([M_Expense]> SUM(Target[Target]),"Yes","No")

Result is as below.

RicoZhou2_3-1660031724862.png

 

Best Regards.

 

Thank you. What relations should I make? Because I need to filter by department and by date

Anonymous
Not applicable

Hi @pagliaci ,

 

According to the code, I think you don't need to create a relationship between target table and expense table. We have added the filter in code.

 

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.

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. I cannot help you without meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive. I cannot use screenshots of your source data.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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!

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.