Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Multiple IF conditions different tables

Hi,

 

I have problem with DAX. I need to combine data between two tables if some criteria is met.

 

Tables;
PriceTable, Contains prices, customer IDs, product IDs and dates

Receided goods table, Contains data about received goods, quantity, customer ID, productID and dates

 

So I have to get both received goods and the price to the same table when

Price table customer ID = Received goods table Customer ID

Price table product ID = Received goods table Product ID

Price table Date = Received goods table Date

 

Is there anyone who might have idea how to combine those data?

  • Power BI provides a feature of combining the data from two tables based on columns with the same values.

    In your requirement, it seems that you have two tables “Price Table”, and “Received Goods” and want to combine these tables using CustomerID, ProductID, and Date columns from both tables.

    So in order to combine both tables using these 3 column values, you can follow the below steps and combine the tables to create a new table with common values.

    1. Navigate to Power Query Editor and click on the Transform tab which has the option for Combine>> Merge Queries>> Merge Queries as New.

    2. This will open the Merge dialog and select the columns required to have same values i.e. in these case select Customer ID, Product ID and Date (PriceTable)/ Received goods Date (Received goods) table. Select the Join Kind as Inner join as we want only matching rows to be filtered out in new table.

    3. This will create a new table with rows matching for both table based on selected columns.

    Please refer to the below screenshot for the same.

     

    Output for the merging tables will be as follows:

    If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

     

    Thanks!

    Inogic Professional Services
    An expert technical extension for your techno-functional business needs
    Power Platform/Dynamics 365 CRM
    Drop an email: [email protected]
    Service: http://www.inogic.com/services/
    Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/

4 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 
    Any relationship between the two table?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      Not at the moment, as I have tried to figure out the best way to merge those queries.

       

      I have tried to do a new key between the tables by using CustomerID+ProductID+FirstDayOfTheMonth. Doing it to both queries and merge queries by those keys.

       

      I also found a slight problem with our data so I will update here if my solution will work after I have fixed the data. 

       

  • Power BI provides a feature of combining the data from two tables based on columns with the same values.

    In your requirement, it seems that you have two tables “Price Table”, and “Received Goods” and want to combine these tables using CustomerID, ProductID, and Date columns from both tables.

    So in order to combine both tables using these 3 column values, you can follow the below steps and combine the tables to create a new table with common values.

    1. Navigate to Power Query Editor and click on the Transform tab which has the option for Combine>> Merge Queries>> Merge Queries as New.

    2. This will open the Merge dialog and select the columns required to have same values i.e. in these case select Customer ID, Product ID and Date (PriceTable)/ Received goods Date (Received goods) table. Select the Join Kind as Inner join as we want only matching rows to be filtered out in new table.

    3. This will create a new table with rows matching for both table based on selected columns.

    Please refer to the below screenshot for the same.

     

    Output for the merging tables will be as follows:

    If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

     

    Thanks!

    Inogic Professional Services
    An expert technical extension for your techno-functional business needs
    Power Platform/Dynamics 365 CRM
    Drop an email: [email protected]
    Service: http://www.inogic.com/services/
    Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi and first of all thanks for answering. 

       

      I actually managed to come out with the identical solution and I can say that it works well.