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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SJRJEJ
New Member

Reference current row value in Filter expression

Hi , 
I seem to be struggling with a  problem in PowerBI.
 I will try to explain the issue with the Product and Sales table example .
In my report , I have a drop down filter for Product and I have a Sales table from which I want to display the sales for the Product and also the total sales for the Product Category under which the Item belongs 
 PRODUCT TABLE
ProductCategory Item
BookB1
BookB2
ClothingDress
FurnitureTable
BookB3
ClothingShirt
FurnitureChairs

 

 

SALES TABLE

Item     Sales    ProdCat

B1100Book
Dress20Clothing
B2200Book
Table10Furniture
Shirt30Clothing
B320Book
Chairs60Furniture
 
 
 
SJRJEJ_0-1681714757917.png

 When I hardcode a particular Product Category , the DAX works :

ProductSales = CALCULATE(sum(Sales[Sales]),FILTER(ALL(Sales), Sales[ProdCat] = "Book"))
In the Above DAX , I want to dynamically reference the Product Category of the item selected in the drop down list box .
I tried using EARLIER function to reference the current value of Sales[ProdCat] but I got the below error .
SJRJEJ_1-1681715042155.png

 

 

How do I override the Filter Context and also apply filter based on the current value of the row?

Any advice would be greatly appreciated.

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

=VAR _prdcat=VALUES(Product[ProductCategory]) RETURN CALCULATE(SUM(Sales[Sales]),FILTER(ALL(Product,Product[ProductCategory] IN _prdcat))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

=VAR _prdcat=VALUES(Product[ProductCategory]) RETURN CALCULATE(SUM(Sales[Sales]),FILTER(ALL(Product,Product[ProductCategory] IN _prdcat))

Thank you so very much !!!! That worked .

Very grateful for your help .

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.