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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TL5866
Frequent Visitor

CALCULATETABLE on ALL(Table) not filtered

Hi,

 

I want to create a table containing (independent of the context) all rows of a table, but filtered on a column. A straighforward way is to use FILTER:

 

MyFilteredTable = FILTER(ALL(MyTable), MyColumn = "MyValue")

My undrstanding is that I could have used CALCULATETABLE with similar results:

 

 

MyCalculatedTable = CALCULATETABLE(ALL(MyTable), MyColumn = "MyValue")

However, the resulting table is not filtered, which might be indeed correct if one consider that the filter is applied before the evaluation of ALL(MyTable).

 

 

Now using a variable should solve that, as I'm sure it will be evaluated before the CALCULATETABLE

 

VAR AllMyTable = ALL(MyTable)
MyCalculatedTable = CALCULATETABLE(AllMyTable, MyColumn = "MyValue")

That is not the case: MyCalculateTable still return on non-filtered table.

Am I missing anything ?

 

Note: I want to use CALCULATETABLE because I have actually a set of values to filter on (like VALUES(MyColumn)), which is not supported by FILTER.

 

2 ACCEPTED SOLUTIONS
MattAllington
Community Champion
Community Champion

The filter portion of calculatetable always gets applied first, then the first parameter. It is not important if the first parameter is a variable or a native formula inside calculatetable in this case. You are first applying a filter and then removing it with all. 

 

Maybe this

 

calculatetable(mytable,filter(all(mytable),mytable[mycolumn]=“myvalue”))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post


@TL5866 wrote:

Thanks. I was expecting that.

 

Then how would you suggest to do something like this, which is not supported by FILTER ?

MyFilteredTable = FILTER(ALL(MyTable), VALUES(MyColumn))

 


MyFilteredTable = calculatetable(mytable,ALL(MyTable), VALUES(MyColumn))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

4 REPLIES 4
MattAllington
Community Champion
Community Champion

The filter portion of calculatetable always gets applied first, then the first parameter. It is not important if the first parameter is a variable or a native formula inside calculatetable in this case. You are first applying a filter and then removing it with all. 

 

Maybe this

 

calculatetable(mytable,filter(all(mytable),mytable[mycolumn]=“myvalue”))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Thanks. I was expecting that.

 

Then how would you suggest to do something like this, which is not supported by FILTER ?

MyFilteredTable = FILTER(ALL(MyTable), VALUES(MyColumn))

 


@TL5866 wrote:

Thanks. I was expecting that.

 

Then how would you suggest to do something like this, which is not supported by FILTER ?

MyFilteredTable = FILTER(ALL(MyTable), VALUES(MyColumn))

 


MyFilteredTable = calculatetable(mytable,ALL(MyTable), VALUES(MyColumn))



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Aaah, right...

 

Thanks !!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors