Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
ALGH08
Frequent Visitor

Summation during filtering

Hello all

 

I have a dataset similar to below.  

 

YearCategory# Instances
2021A15
2021B15
2021C15
2022A10
2022B20
2022C30
2023A45
2023B39
2023C24

 

I want to be able to filter for 2023 and see something similar to the output below

Category2023 InstancesTotal Aggregated Instances
A4570
B3974
C2469

 

Thanks in advance!

3 REPLIES 3
Wilson_
Super User
Super User

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:

Wilson__0-1682995888543.png

 

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?)




Did I answer your question? Mark my post as a solution!

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?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.