Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

SQL join in Power Bi with DAX

I want to create a table  like in the picture below. Same rows of table A and B should't be in the new table.

 

4 Replies

  • aj1973's avatar
    aj1973
    Community Champion

    Hi Anonymous 

    You need to be more precise in your thread, but in Power Query you can achieve that 

    Use Merge Queries.

  • Anonymous's avatar
    Anonymous
    Not applicable

    I need to create legend for a dot-plot. 

    I have a table with columns: rivet_points | result_id | machine_classification | ....

    One rivet_point can have multible result_id's.

    My database gives every result_id a machine_classification (0 or 1) and I need for every last id of every rivet_point a new machine_classification (for example 2).

    So that I can colour the dot-plot with machine_classification and get to see the last result_id's.

     

    At the moment I have a table with all last result_id's. But if I create a new table with the function UNION I get dublicates of all the rows with these result_id's.

     

    Table "last_results" with all last result_id's to every rivet_point:

    last_results =
    ADDCOLUMNS (
        SUMMARIZE ( result, result[rivet_points]),
        "result_id", CALCULATE ( MAX ( result[result_id] ) )
    )
    ("result_id", "result_id" and mc are inplemnted by hand)

     

    I wanted to creste a seprate table in which all the last result_id's don't exist so I can use the function UNION again and get a table in which these result_id's have a different machine_classificaton.

     

    • aj1973's avatar
      aj1973
      Community Champion

       Anonymous 

      Am not sure to understand your model, but are trying to add a column(result_id) to your Summarized table and you want to select the Null Value of machine_classification !

      If so then I think you need to add a filter context to your CALCULATE ( MAX ( result[result_id] ) ) by machine_classification = 0

  • Anonymous's avatar
    Anonymous
    Not applicable

    Sorry, but that's not what I meant. I try to describe it in a other way.

    I want to realise a SQL join of two tables with DAX.

    I have two tables, tabel A and B. Both have the same columns-structure.

     

    Some of the rows of table B can be found in table A. 

    I want to get a new table that has all the rows of table A minus the rows that can be found in table B.

     

    Like in the picture of the first post to see, i only want the red part in my new table.