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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

CALCULATED TABLE USING MEASURE AS FILTER CRITERIA

Hi All, I am n newbie to DAX, with some experience in PL/SQL, stuck at situation am unable to resolve. Appreciate any suggestion from datanuts here, let me sum-up the situation using a proxy scenario;

 

I have created a slicer for the user to select ACCOUNT_FACT[ACCOUNT] from TABLE(2) ACCOUNT_FACT, which is then fed into a measure AC_SELECTED = SLELECTEDVALUE (ACCOUNT_FACT[ACCOUNT]), I want to pass on this value dynamically as filter criteria to create a new TABLE(3)  SALES_REP from existing TABLE(1) SALES_FACT

 

SALES_REP =

CALCULATETABLE(

DISTINCT (SELECTCOLUMNS(SALES_FACT,”SALE_GUYS”,SALES_FACT[SALES_REP]

   FILTER(SALES_FACT,

    SALES[ACCOUNT] = AC_SELECTED

)

However this doesn’t seem to work, I tried variable also. What I have realized in the process is that CALCULATETABLE function will not work using slicer values, as the tables are generated at the time of model load and hence any slicing post that will not dynamically refresh dependent tables. Is theer a work-around aproach ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous -

It is true that Calculated Tables are created at refresh time, while Measures are calculated at query time. 

It seems that you are trying to filter on a column - I think you need an Account dimension table. You can create a relationship to each of your fact tables and use the Account from the new dimension table to filter the fact tables.

Hope this helps,

Nathan

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Anonymous -

It is true that Calculated Tables are created at refresh time, while Measures are calculated at query time. 

It seems that you are trying to filter on a column - I think you need an Account dimension table. You can create a relationship to each of your fact tables and use the Account from the new dimension table to filter the fact tables.

Hope this helps,

Nathan

Could I possibly get a little more context here? I have the exact same issue.

Anonymous
Not applicable

@Anonymous 

 Works like magic! Thanks Nathan, that was very helpful, not just in getting around the problem, but also understanding how relationship can be configured to create a background for developing complex dependent functionalities. Cheers!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.