Forum Discussion

Matthew1900's avatar
Matthew1900
Frequent Visitor
4 years ago
Solved

Table Viz with DAX Calculated Dimension Column

Hi All - I would greatly appreciate thoughts on the below issue that has stumped me. 

 

I am attempting to create a simple table viz in PBI Desktop that includes a calculated column from one table based on a LOOKUPVALUE formula referencing columns in a separate table. The logic is to look for a certain value from Table 1 in one column of Table 2, and, if found, transform it to the corresponding value in a different column of Table 2. If the value is not found in Table 2, the calculated column is populated by the original value from Table 1. 

Calculated Column Formula:

Custom Sales Campaign Name = LOOKUPVALUE(
  Table2[New Campaign Name],Table2[Existing_Taxonomy],Table1[Campaign],Table1[Campaign])
 
Result:
In a simple table visualization, the values are not correctly displaying when I only include the Calculated Column from Table 1 in the table; however, when I also include the referencing column (i.e. Table 2[Existing_Taxonomy]) from Table 2, the data appears correctly. 
 
Does anyone have any insights on why this might be happening? Thanks so much in advance for any guidance and expertise on this!
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Matthew1900 ,

    I created some data:

    Table1:

    Table2:

    Here are the steps you can follow:

    1. Create calculated column.

    Calculated Column Formula =
    var _Table1=
    SELECTCOLUMNS('Table2',"1",[Group])
    return
    IF(
    'Table1'[Group] in _Table1,
    CALCULATE(
    SUM('Table2'[Amount2]),FILTER(ALL(Table2),'Table2'[Group]='Table1'[Group]))
    ,'Table1'[Amount])

    2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Matthew1900 ,

    I created some data:

    Table1:

    Table2:

    Here are the steps you can follow:

    1. Create calculated column.

    Calculated Column Formula =
    var _Table1=
    SELECTCOLUMNS('Table2',"1",[Group])
    return
    IF(
    'Table1'[Group] in _Table1,
    CALCULATE(
    SUM('Table2'[Amount2]),FILTER(ALL(Table2),'Table2'[Group]='Table1'[Group]))
    ,'Table1'[Amount])

    2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly