Forum Discussion

pbhat89's avatar
pbhat89
Helper II
5 years ago

Conditional table using Dax / query on the fly

I have a tables as below :

Table 1 - granularity level is VID,NID - unique combination key

VIDNIDAgeHeight
a134167
a223156
b354189
b465187
b523160
c612189
d756188

 

Table 2 - granularity level is VID,NID,condition- unique combination key. note VID , NID can repeat with different conditions

VIDNIDCondition
a2x1
d7x2

 

 

Target is to achieve tables ( caluculated or temp ) after following options to filter 

 

FILTERS (only for e.g. set below)

Age  <=50

Height <=190

Condition = X1 [this is required as anti filter , i.e. remove not keep]

 

Expected tables to be generated and refreshed (as filters changed)

 

Table 3 - filtered table 

VIDNIDAgeHeight
a134167
b523160
c612189

 

a,2 was removed as it had x1 condition and b4,b3 were removed due to age filter

 

Table 4 ( Except (all ( Table 1) , table 3) : i.e. all records that were filtered out from main table

VIDNIDAgeHeight
b354189
b465187
a223156

 

Once these two tables are generated, i will create calculations based on that. how do i create these tables as temp or permamnent tables in power bi ( interactively updating as filters change ) 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi pbhat89 ,

     

    So, you want to create table3 and table4 by Dax or Query? But table3 is based on filter and can't be dynamic if you want it as a fact table. Please let me know if I misunderstand your meaning.

     

    Best Regards,

    Jay

    • pbhat89's avatar
      pbhat89
      Helper II

      exactly - tables 3 and 4 are dynamic as they change based on filters. I am okay it not being a fact table as long as i can refer to the columns from these tables. Hence okay even somehow i can create them as temp tables.