cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brettp761
Advocate II
Advocate II

Composable DAX Table Functions

CALCULATE() AND CALCULATETABLE() are the only two functions for manipulating filter context (adding to, replacing, or ignoring other filters) so these have to be at the top of my list but it's the functions you pass to them as filter arguments, and sometimes the functions within these functions, that really unleashes the power of DAX.

 

ALL() is often one of these common filter arguments as you want your expression to ignore a filter on a particular column, the entire table, or all columns in the table except a few columns (use ALLEXCEPT() function) .

 

FILTER() is another very common argument function for CALCULATE() that enables you to pass in a 'rich' filter argument such as a measure which isn't allowed by CALCULATE or CALCULATETABLE() alone.

 

So you'll often see expressions like the following:

 

MyMetric:= CALCULATE([MetricA],FILTER(ALL(Product),[MySalesMetric] > 500))

 

In this case we want to modify the filter context applied to Metric A - we want to remove all filters on the Product table via ALL but then filter the rows of this full table (one by one, iterating with FILTER) by a metric (MySalesMetric) such that only rows with over 500 are included. This final, modified Product table is used via relationship to your Fact table (of MetricA) to filter out its rows and then compute MetricA.

 

VALUES() is very important and flexible as well for working with individual columns. Values - Power Pivot Pro

 

The new CROSSFILTER function will be extremely useful for working with complex models. (Bidirectional and CrossFilter White Paper)

 

Variables (VAR) and the new INTERSECT, EXCEPT, and UNION functions will greatly simplify and sometimes improve performance of DAX code as well.

 

 

 

 

 

 

 

 

 

 

 

 

0 REPLIES 0

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors