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
mdannemiller
Frequent Visitor

Using non-explicit Filters in Measures?

I need to compare a calculated value to the same calculated value where 2 fields are matched.

 

for example, if I'm looking at bus fare I'd have a table like this:

 

[Fare paid], [Route], [City], [State], [riderID] 

 

So let's say that for route 1, the sum of all the fares paid is $10,000.  I can use a simple measure Calculate(SUM([Fare paid]) to find it.  However, I then need to compare that total to the fares paid for all routes in the same city and state.  So.  Let's say for Austin, TX route 1, the total is 100,000.

 

I'm having huge issues making this work.  if I use CALCULATE(SUM([fare paid], ALLEXCEPT('Bus Fare Fact', [City], [State])) I get the sum for everything.  I'd want to do a filter like this CALCULATE(SUM([Fare paid]), [City] = [City], [State] = [State])) But that obviously doesn't work.  Is there a way that I can access that value with a measure?  I tried with a calculated column where I know I can reference the column, but, because I'm using this calculation multiple times, it was taking 5-10 minutes to render the page, so I need to use a measure for performance issues.  

 

I also can't use a separate table to do the calculations (at least a non-memory table), because I have a rider table with demographic information about the rider that is used in filters in this table.

2 REPLIES 2
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @mdannemiller,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @mdannemiller,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create a measure:

Filter value = CALCULATE(SUM(Table1[Fare paid]),FILTER(ALL('Table1'),'Table1'[State]=MAX('Table1'[State])), FILTER(ALL('Table1'),'Table1'[City]=MAX('Table1'[City])))

Result:

1.PNG

If I misunderstand you, could you please share some sample data and post your desired result if possible?

Also, you could download my pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.