The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
I have two tables as follow
Table: Target
Target Table is unique table. It has four projects, tasks, Layout and target for each.
Table: Actual
Actual table has month, sales for each project according to Layout and task. At present only three project has been sold.
Both the table has been connected through Custom column
What I need?
I need to calculate Remaining sales = Target - Total Sales. Target from Target table and Total Sales from Actual table.
Please note target table doesn't have date or month.
Once I calculate the Remaining sales, I need to visualize by Month. I did by using below dax measures
Remaining Sales = SUM(Target[Target]) - SUM(Actual[Total Sales])
The remaining sales values are wrong, I think it's not taking the month properly as target table doesn't have one. Can anyone advise how to fix this?
Attached power bi file. https://we.tl/t-jyuLdOuN0R
Solved! Go to Solution.
Hi @Sean500 ,
Please try:
First create a new table:
Then build relationship:
Apply the measure:
Remaining Sales =
var _a = ALLSELECTED(Project[Project])
return SUM(Target[Target]) - CALCULATE(SUM(Actual[Total Sales]),FILTER(ALL(Actual),[Project] in _a&&[Date]<=MAX('Actual'[Date])))
Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @v-jianboli-msft It is correct against month. However, when I use Project as a filter, the values are not correct Can you please confirm?
Hi @Sean500 ,
Please try:
First create a new table:
Then build relationship:
Apply the measure:
Remaining Sales =
var _a = ALLSELECTED(Project[Project])
return SUM(Target[Target]) - CALCULATE(SUM(Actual[Total Sales]),FILTER(ALL(Actual),[Project] in _a&&[Date]<=MAX('Actual'[Date])))
Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Sean500 ,
Please try:
Remaining Sales = SUM(Target[Target]) - CALCULATE(SUM(Actual[Total Sales]),FILTER(ALL(Actual),[Date]<=MAX('Actual'[Date])))
Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
121 | |
83 | |
74 | |
54 | |
46 |
User | Count |
---|---|
134 | |
124 | |
78 | |
64 | |
63 |