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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kap_55
Frequent Visitor

Filter table by 2 conditions and then sum values

Hi,

I would like to filter based on Category but category changes each year. Can I do that in measure?

Capture1.PNG

I hope it's clear from the picture.

Thanks.

B.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@kap_55 Create following measure in source table

Measure = 
VAR _year = MAX(Source[Year])
VAR _color = CALCULATETABLE(VALUES(Mapping[Category]),Mapping[Year]=_year)
RETURN CALCULATE(SUM(Source[Value]),Source[Category] IN _color)

As per my understanding 2017 sum of value should be 7. 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@kap_55 Create following measure in source table

Measure = 
VAR _year = MAX(Source[Year])
VAR _color = CALCULATETABLE(VALUES(Mapping[Category]),Mapping[Year]=_year)
RETURN CALCULATE(SUM(Source[Value]),Source[Category] IN _color)

As per my understanding 2017 sum of value should be 7. 

Works awesome. Thanks.

Yes. My mistake 🙂

Let me try your solution.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.