Forum Discussion

cs141005's avatar
cs141005
Regular Visitor
5 years ago
Solved

how to retrieve selected values from another table (with no relationship)

Hi all,   I have 2 tables : Sales and Sales BR. My purpose is to fill Sales BR table with selected values from Sales table. Also i want to make some calculations.. There is no relationship betwe...
  • Anonymous's avatar
    Anonymous
    5 years ago

    cs141005 

    Here are the steps you can follow:

    1. Enter the Power query through Transform data, add Index to the two tables respectively, and select Add column Index Column.

    2. Create calculated column.

    Q1 =
    IF(
        'Sales BR'[Index] in SELECTCOLUMNS('Sales',"1",'Sales'[Index]),
        SUMX(FILTER(ALL('Sales'),'Sales'[Index]='Sales BR'[Index]),[Q1]),
        DIVIDE(
            SUMX(FILTER(ALL(Sales),'Sales'[type]="new users"),[Q1]),
            SUMX(FILTER(ALL(Sales),'Sales'[type]="users"),[Q1])
        ))
    Q2 =
    IF(
        'Sales BR'[Index] in SELECTCOLUMNS('Sales',"1",'Sales'[Index]),
        SUMX(FILTER(ALL('Sales'),'Sales'[Index]='Sales BR'[Index]),[Q2]),
         DIVIDE(
            SUMX(FILTER(ALL(Sales),'Sales'[type]="new users"),[Q2]),
            SUMX(FILTER(ALL(Sales),'Sales'[type]="users"),[Q2])
        ))

    3. Result:

     

    Best Regards,

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