Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello all
I have a dataset similar to below.
Year | Category | # Instances |
2021 | A | 15 |
2021 | B | 15 |
2021 | C | 15 |
2022 | A | 10 |
2022 | B | 20 |
2022 | C | 30 |
2023 | A | 45 |
2023 | B | 39 |
2023 | C | 24 |
I want to be able to filter for 2023 and see something similar to the output below
Category | 2023 Instances | Total Aggregated Instances |
A | 45 | 70 |
B | 39 | 74 |
C | 24 | 69 |
Thanks in advance!
Hello ALGH,
Try these two measures:
Total Aggregated Instances = SUM ( 'Table'[# Instances] )
2023 Instances =
CALCULATE (
[Total Aggregated Instances],
'Table'[Year] = 2023
)
I end up with your expected result, using your data:
It also looks like you could benefit from some basic DAX training. 🙂 I'm a big fan of SQLBI. Check this out as a good starting point.
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)
Proud to be a Super User! | |
thanks - i think this works, but gives a specific situational result. What happens if / when I decide to filter on 2022? Do i need to create another measure?
My dataset is quite large and i wouldnt want to make a new measure for each possibility
If you wanted dynamic measures that work with a year slicer on the page, the second measure above can look like this instead:
Selected Year Instances =
CALCULATE (
[Total Aggregated Instances],
'Table'[Year] = SELECTEDVALUE ( 'Table'[Year] )
)
If you wanted to show the total regardless of your year filter, you would need another measure that looks like:
All Years Instances =
CALCULATE (
[Total Aggregated Instances],
REMOVEFILTERS ( 'Table'[Year] )
)
----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)
Proud to be a Super User! | |
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 |
---|---|
10 | |
9 | |
8 | |
8 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
9 |