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.
Problem Statement: How to limit the number of values aggregated at a specific date. This date could be calendar date, years, quarters, or months.
Background: I work in a consulting company and our projects with clients are revision based in that on the same project, when the client wants more work, we add a revision rather than starting a new project. So a project could get 50 hours of work in January as revision 0 and another 100 hours of work in May and that would be revision 1.
Sample Data
Project Code | Year | Quarter - Year | Month Year | Revision Number | Planned Hours | |||||
1A1 | 2021 | 2021-04 | 2021 October | 6 | 300 | |||||
1A1 | 2021 | 2021-04 | 2021 October | 5 | 275 | |||||
1A1 | 2021 | 2021-03 | 2021 September | 4 | 150 | |||||
1A1 | 2021 | 2021-03 | 2021 August | 3 | 150 | |||||
1A1 | 2021 | 2021-03 | 2021 August | 2 | 100 | |||||
1A1 | 2021 | 2021-02 | 2021 April | 1 | 50 | |||||
1A1 | 2021 | 2021-02 | 2021 April | 0 | 50 |
Desired Output:
Case 1: Only Years visible
Project Code | Year | Planned Hours | ||
1A1 | 2021 | 300 |
Case 2: Quarter Year visible
Project Code | Quarter - Year | Planned Hours | ||
1A1 | 2021-04 |
| 300 | |
1A1 | 2021-03 | 150 | ||
1A1 | 2021-02 | 50 |
Case 3: Month Year visible
Project Code | Month - Year | Planned Hours | ||
1A1 | 2021 October | 300 | ||
1A1 | 2021 September | 150 | ||
1A1 | 2021 August | 150 | ||
1A1 | 2021 April | 50 |
Caveat: the heirarchy values that will be used will be in a bar chart and either years, quarter - years, or month - years will be on the x-axis and this will be used in a measure, not a calculated column.
I am at a loss how to limit the aggregation like this and would appreciate some assistance.
Solved! Go to Solution.
Between my posting this and now I came up with a great start that uses what you have but also incorporates a disconnected revision number table.
The disconnected table is:
Revision Number Table = DISTINCT('Table'[Revision Number])
MaxPH =
var max_rev = MAX('Table'[Revision Number])
var slns =
CALCULATE(SUM('Table'[Planned Hours]),
'Table'[Revision Number] = max_rev)
RETURN
SWITCH(SELECTEDVALUE('Revision Number Table'[Revision Number]),
max_rev, slns, blank())
the only issue now is to show the intervening dates as having 0 planned hours.
Basically to have months like 2021 November show as 0 hours.
Between my posting this and now I came up with a great start that uses what you have but also incorporates a disconnected revision number table.
The disconnected table is:
Revision Number Table = DISTINCT('Table'[Revision Number])
MaxPH =
var max_rev = MAX('Table'[Revision Number])
var slns =
CALCULATE(SUM('Table'[Planned Hours]),
'Table'[Revision Number] = max_rev)
RETURN
SWITCH(SELECTEDVALUE('Revision Number Table'[Revision Number]),
max_rev, slns, blank())
the only issue now is to show the intervening dates as having 0 planned hours.
Basically to have months like 2021 November show as 0 hours.
I don't know the particularities of your data model, couldn't reproduce the issue. Version with blank():
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@sjrrkb123 , use 0 instead of blank ().
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@ERD
Unfortunately that gives blanks for every period in the calendar table I am using rather than just the intervening periods.
@sjrrkb123 , so you need to define most recent planned hours vesrion for defined period (either years, quarter - years, or month - years) ?
You can use a measure:
MaxPH =
VAR mostRecentProjectCode =
MAX ( 'Table'[Revision Number] )
RETURN
CALCULATE (
MAX ( 'Table'[Planned Hours] ),
'Table'[Revision Number] = mostRecentProjectCode
)
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
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 | |
11 | |
11 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |