Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
And I want to compare that with the target for the month for example:
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
Solved! Go to Solution.
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.
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.
New Table:
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.
Best Regards.
Thank you. What relations should I make? Because I need to filter by department and by date
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.
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