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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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