Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
In the model if I select 'Quota Results'[Location Quota] and 'Current Hierarchy 2'[Sales Code] and then put a filter in the report for 'Calendar 2'[Month Year]October 2024, it correctly shows the Sales Codes and Location Quota for the month. But I've added another table that has the fields 'BCP'[UniqueID] and 'BCP'[Date Closed] among others. UniqueID is equivilant to Sales Code. I created a table using DAX:
Table Location Quota = SELECTCOLUMNS(
'Current Hierarchy 2',
"SalesCode", [Sales Code],
"LocQuota", [Location Quota])
I then created relationships between 'BCP'[UniqueID] and 'Current Hierarchy'[Sales Code] and relationship 'BCP'[Date Closed] and 'Calendar 2' [Date]. Now when I select "SalesCode" and "LocQuota" I get individual totals for the location. But the LocQuota is summing the quota for several years instead of the month of when location was closed in 'BCP'. I've tried numerous measures but I get the same grand total of all the locations quota in each row. Any insight into how to filter it for the month would be greatly appreciated. BTW Location Quota is determined by Month whereas Date Closed is a date like Friday, October 2, 2024, so I even created a measure StartofMonth=STARTOFMONTH('BCP'[DateClosed]) and then a measure:
QuotaDateFilter = CALCULATE([SumLocQuota],FILTER(All('Calendar 2'),'Calendar 2'[Date]=('BCP (2)'[StartofMonth])))
It takes up too much resource or other measures I've tried put the grand total of all the locations in each row. Please help.
Solved! Go to Solution.
The issue you're experiencing is due to the lack of a date relationship between your 'Current Hierarchy 2' table (which contains 'Location Quota') and your 'Calendar 2' table. Because 'Location Quota' is determined by month, but there is no date linking 'Current Hierarchy 2' to 'Calendar 2', the date filters in your report are not affecting the 'Location Quota' totals, causing it to sum over all years.
Solution:
Add a Date Column to 'Current Hierarchy 2':
Create a Relationship Between 'Current Hierarchy 2' and 'Calendar 2':
Adjust Your Measures and Visuals:
Alternative Measure (If Adding a Date Column Is Not Feasible):
If you cannot modify the 'Current Hierarchy 2' table, you can create a measure that filters the 'Location Quota' based on the 'Date Closed' in 'BCP':
SumLocQuotaFiltered =
VAR ClosedDate = SELECTEDVALUE('BCP'[Date Closed])
VAR StartOfMonth = DATE(YEAR(ClosedDate), MONTH(ClosedDate), 1)
VAR EndOfMonth = EOMONTH(ClosedDate, 0)
RETURN
CALCULATE(
SUM('Current Hierarchy 2'[Location Quota]),
FILTER(
'Current Hierarchy 2',
'Current Hierarchy 2'[Sales Code] = SELECTEDVALUE('BCP'[UniqueID])
),
FILTER(
'Calendar 2',
'Calendar 2'[Date] >= StartOfMonth &&
'Calendar 2'[Date] <= EndOfMonth
)
)
Notes:
SELECTEDVALUE
works when there's only one value in the current context. Make sure your visuals are set up to provide a single 'Sales Code' and 'Date Closed' per row.Recommendation:
For the best results, adding a date column to 'Current Hierarchy 2' and establishing a proper relationship with 'Calendar 2' is the most effective solution. This aligns your data model properly and allows Power BI's built-in filtering to work as intended, ensuring accurate totals without complex measures.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn|Twitter|Blog |YouTube
Hi @BrianNeedsHelp ,
Is my follow-up just to ask if the problem has been solved?
If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?
Thank you very much for your cooperation!
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The issue you're experiencing is due to the lack of a date relationship between your 'Current Hierarchy 2' table (which contains 'Location Quota') and your 'Calendar 2' table. Because 'Location Quota' is determined by month, but there is no date linking 'Current Hierarchy 2' to 'Calendar 2', the date filters in your report are not affecting the 'Location Quota' totals, causing it to sum over all years.
Solution:
Add a Date Column to 'Current Hierarchy 2':
Create a Relationship Between 'Current Hierarchy 2' and 'Calendar 2':
Adjust Your Measures and Visuals:
Alternative Measure (If Adding a Date Column Is Not Feasible):
If you cannot modify the 'Current Hierarchy 2' table, you can create a measure that filters the 'Location Quota' based on the 'Date Closed' in 'BCP':
SumLocQuotaFiltered =
VAR ClosedDate = SELECTEDVALUE('BCP'[Date Closed])
VAR StartOfMonth = DATE(YEAR(ClosedDate), MONTH(ClosedDate), 1)
VAR EndOfMonth = EOMONTH(ClosedDate, 0)
RETURN
CALCULATE(
SUM('Current Hierarchy 2'[Location Quota]),
FILTER(
'Current Hierarchy 2',
'Current Hierarchy 2'[Sales Code] = SELECTEDVALUE('BCP'[UniqueID])
),
FILTER(
'Calendar 2',
'Calendar 2'[Date] >= StartOfMonth &&
'Calendar 2'[Date] <= EndOfMonth
)
)
Notes:
SELECTEDVALUE
works when there's only one value in the current context. Make sure your visuals are set up to provide a single 'Sales Code' and 'Date Closed' per row.Recommendation:
For the best results, adding a date column to 'Current Hierarchy 2' and establishing a proper relationship with 'Calendar 2' is the most effective solution. This aligns your data model properly and allows Power BI's built-in filtering to work as intended, ensuring accurate totals without complex measures.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn|Twitter|Blog |YouTube
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
10 | |
10 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |