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
astroadmin
New Member

DAX - Calculate with Filter using table column value

Hi Everyone,

 

I am trying to make a DAX function work. For some reason, searching for hours couldnt find a solution. Any help will be greatly appriciated.

 

Result =
CALCULATE(
     SUM(DATA[Estimated Annual Revenue]),
     FILTER (
          ALL ( DATA[BusinessUnit] ), DATA[BusinessUnit] = This Rows BU column value
     )
)

 

So when I type something static the DAX function works. However I want to be able to filter the DATA table based on the current tables BU column value. 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

If this is a column, you should be able to use:

 

Result =
CALCULATE(
     SUM(DATA[Estimated Annual Revenue]),
     FILTER (
          ALL ( DATA[BusinessUnit] ), DATA[BusinessUnit] = EARLIER([BU])
     )
)

 

If it is a measure, you could use:

Result =
VAR __BU = MAX('DATA'[BU])
RETURN
CALCULATE(
     SUM(DATA[Estimated Annual Revenue]),
     FILTER (
          ALL ( DATA[BusinessUnit] ), DATA[BusinessUnit] = __BU
     )
)

 

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

If this is a column, you should be able to use:

 

Result =
CALCULATE(
     SUM(DATA[Estimated Annual Revenue]),
     FILTER (
          ALL ( DATA[BusinessUnit] ), DATA[BusinessUnit] = EARLIER([BU])
     )
)

 

If it is a measure, you could use:

Result =
VAR __BU = MAX('DATA'[BU])
RETURN
CALCULATE(
     SUM(DATA[Estimated Annual Revenue]),
     FILTER (
          ALL ( DATA[BusinessUnit] ), DATA[BusinessUnit] = __BU
     )
)

 

 

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

My question may not have been clear enough.

 

So there are two tables DATA and Dashboard_1, I am adding a measure to Dashboard_1 to filter and sum values in DATA. Both tables have a column named BU which has to match.

 

To sum up, the result should return Summation of DATA[Estimated Annual Revenue] for those records Dashboard_1[BU] = DATA[BU] 

 

When I try your solution I receive an error;

EARLIER/EARLIEST refers to an earlier row context which doesn't exist.

 

1.png

The first one is suggested as column not Measure

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak and @Greg_Deckler ,

 

I see what you mean, yes the newly added field was a measure, thats why it was not working. When I changed new measure to new column, things started to work!

 

Thanks a lot.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.