Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

IF condition based on two different tables

Hi guys,     I need to compare two values from two different tables, and I believe perhaps a calculated measure could solve this. But I haven't figured out a way to actually do this.   I have tw...
  • Thejeswar's avatar
    Thejeswar
    8 years ago

    Hi Anonymous,

    For using Related(), you need to have a direct active relationship between the tables. In your case, Budget and Enhacements.

     

    If possible, create a link between them. In case if not possible, try to create an inactive relationship between them and use the USERELATIONSHIP() DAX in your calculated column to get the desired column from Enhacements table. But I am not sure, if it will allow you to use something like RELATED() with it. Need to check on this functionality. Instead you can use SUMMARIZE() Function for the same

     

    Model:

     

     

    1. Create the column as below. I was able to achieve the first column using a different approach as shown below

     

     

    Enhancements.Value = CALCULATETABLE(SUMMARIZE(Enhancements,Enhancements[VALUE]), USERELATIONSHIP(Budgets[ID],Enhancements[ID]))

    This shows my Budget table before and after including that new column. Also shows the other tables that I have considered

     

     

     

    The Other steps would remain the same

     

    2. Column2 = If('Budget'[Value] = 0 || 'Budget'[Value] = "" || 'Enhancement'[Value] = 0 || 'Enhancement'[Value] = "",X, [Value] 

    3. Then in your report you can filter out X for column 2

     

    P.S. Get Detailed info of those functions and their usage from the links provided

     

    Regards,

    Thejeswar