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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
jianlong
Resolver I
Resolver I

Create a dynamic table from two separate tables

File for test.pbix 

Hi all, 

Trying to find a simple solution for this  problem, hope you can share some ideas, thanks.  

1) "All" table is the master key table 

2) 1:many relationship to "A"-"E" table,   these tables all have a different dimension, "A-Dim".. 

3) The purpose if to find the intersection among "A"-"E", if a dimension is selected, the corresponding will intersect for cohort; 

4) seletion of Dim slicers is random depending on different combinations, so I don't want to use all the possible combinations of isfiltered,  in this case, total 32 combinations.

  

My thoughts are:
1) if a table is filtered, then    _t_a = distinct(A[KEY]),  if not filtered,  then this table will not participate cohort intersection, so I will use _t_all = distinct('All'[Key]).  

  

2), this works: 

 

Intersection2 = 

var _t_a = distinct(A[KEY])
var _t_b = distinct(B[KEY])
var _t_c = distinct(C[KEY])
var _t_d =  distinct(D[KEY])
var _t_e = distinct(E[KEY])
return

countrows(distinct(INTERSECT(INTERSECT(INTERSECT(INTERSECT(_t_a,_t_b),_t_c),_t_d),_t_e)))

 

 

3) however, this does not work, any idea?  thanks. 

 

Intersection =
// create dynamic tables for each data table, if dim is filtered, then find distinct key; if not filtered (all for slicer), then use all table)
VAR _t_a =
    SWITCH (
        TRUE (),
        ISFILTERED ( A[A_DIM] ), DISTINCT ( A[KEY] ),
        DISTINCT ( 'All'[Key] )
    )
VAR _t_b =
    SWITCH (
        TRUE (),
        ISFILTERED ( B[B_DIM] ), DISTINCT ( B[KEY] ),
        DISTINCT ( 'All'[Key] )
    )
VAR _t_c =
    SWITCH (
        TRUE (),
        ISFILTERED ( C[C_DIM] ), DISTINCT ( C[KEY] ),
        DISTINCT ( 'All'[Key] )
    )
VAR _t_d =
    SWITCH (
        TRUE (),
        ISFILTERED ( D[D_DIM] ), DISTINCT ( D[KEY] ),
        DISTINCT ( 'All'[Key] )
    )
VAR _t_e =
    SWITCH (
        TRUE (),
        ISFILTERED ( E[E_DIM] ), DISTINCT ( E[KEY] ),
        DISTINCT ( 'All'[Key] )
    )
RETURN
    COUNTROWS (
        DISTINCT (
            INTERSECT (
                INTERSECT ( INTERSECT ( INTERSECT ( _t_a, _t_b ), _t_c ), _t_d ),
                _t_e
            )
        )
    )

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @jianlong ,

By my test, the dynamic table expression can't be used in the INTERSECT or FILTER function as a table anyway, actually a calculated table/column cannot be dynamic, as they can only compute during data refresh.
Best Regards,
Community Support Team _ kalyj

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @jianlong ,

By my test, the dynamic table expression can't be used in the INTERSECT or FILTER function as a table anyway, actually a calculated table/column cannot be dynamic, as they can only compute during data refresh.
Best Regards,
Community Support Team _ kalyj

@v-yanjiang-msft   Thank you for confirming this.   

Hi @jianlong ,

You're welcome! If you don't have other problems, would you like to mark your reply as the solution. Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

 

Best Regards,
Community Support Team _ kalyj

jianlong
Resolver I
Resolver I

Any solutions?   I tried a bunch, did not work so far.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.