Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Add table to query editor

Hi,

 

I want to add one table to another and I know how to do it in the query editor.

 

But the table I want to add was created outside the query editor in the "data" area. So the table is not shown in the query editor. 

 

Is there a way to add the other table to the query editor?

 

Thanks!

Mark

3 Replies

  • Anonymous what is the DAX expression used to add data table.  You cannot take date table by DAX in Power Query but we can look at DAX code and try to generate it in Power Query. share the DAX expression.

     

    Any reason why you need it in power query?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi parry2k ,

       

      the only reason why I want it in Power Query is, because I know how to work with it there. But a DAX solution would also be fine.

       

      Here are the different example tables:

      table 1 (Power Query)					
      					
      name	type	value	month	year	
      A	ext	3	may	2018	
      B	ext	3	jun	2018	
      					
      					
      table 2 (DAX)					
      					
      name	type	value	year	position	
      C	int	2	2017	doe	
      D	int	4	2017	doe2	
      					
      					
      final table					
      					
      name	type	value	month	year	position
      A	ext	3	may	2018	0
      B	ext	3	jun	2018	0
      C	int	2	0	2017	doe
      D	int	4	0	2017	doe2

      My goal is to have the final table.

       

      The DAX code for table 2 is:

      FinalTable = 
      CALCULATETABLE (
          'TEMPTABLE';
          FILTER (
              'TEMPTABLE';
              'TEMPTABLE'[Value]
                  <= IF ( ISBLANK ( YEAR ( 'TEMPTABLE'[exit] ) ); 2019; YEAR ( 'TEMPTABLE'[exit] ) )
                  && 'TEMPTABLE'[Value] >= YEAR ( 'TEMPTABLE'[entry] )
          )
      )

      But this is different from my example tables above, as the real tables are much more complex. 

       

      I justs need to understand the logic, how to match certain columns in different tables to form a new table.

       

      Thank you!

      Mark