Конвертировать формулу Excel в PowerBI - PullRequest
0 голосов
/ 31 марта 2020

У меня проблемы с переводом формулы с помощью vlookup в powerbi, она не может вернуть выделенное значение

Формула:

=IFS(AND(C20="Female"; F20>0); 1-F20; AND(C20="Female"; F20<0); 1; AND(C20="Male"; VLOOKUP(CONCAT(B20;"-";"Female";"-";D20);E:H;2;FALSO)<0);G20+VLOOKUP(CONCAT(B20;"-";"Female";"-";D20);$E$2:$H$69;2);AND(C20="Male"; VLOOKUP(CONCAT(B20;"-";"Female";"-";D20);E:H;2;FALSO)>0);F20)

Таблица :


| Job family-ID | Gender | Func    | Key              | Total Compensation | Total Compensation 2 | TC   |
|---------------|--------|---------|------------------|--------------------|----------------------|------|
| e             | Female | Average | e-Female-Average | -38%               | -38%                 | 100% |
| e             | Female | Median  | e-Female-Median  | 43%                | 43%                  | 57%  |
| e             | Male   | Average | e-Male-Average   | 100%               | 100%                 | 62%  |

Я создал этот код в powerbi, но он не может вернуть 62% на T C (Unajusted Gender Pay Gap - это имя таблицы

Код в Power BI

=
IF (
    AND (
        'Unadjusted Gender Pay Gap'[Gender] = "Female";
        'Unadjusted Gender Pay Gap'[Total Compensation] > 0
    );
    1 - 'Unadjusted Gender Pay Gap'[Total Compensation];
    IF (
        AND (
            'Unadjusted Gender Pay Gap'[Gender] = "Male";
            LOOKUPVALUE (
                'Unadjusted Gender Pay Gap'[Total Compensation];
                'Unadjusted Gender Pay Gap'[Key]; CONCATENATEX (
                    'Unadjusted Gender Pay Gap';
                    'Unadjusted Gender Pay Gap'[Job family-ID]
                        & " " & "Female" & " " & 'Unadjusted Gender Pay Gap'[Func];
                    "-"
                )
            ) < 0
        );
        'Unadjusted Gender Pay Gap'[Total Compensation]
            + LOOKUPVALUE (
                'Unadjusted Gender Pay Gap'[Total Compensation];
                'Unadjusted Gender Pay Gap'[Key]; CONCATENATEX (
                    'Unadjusted Gender Pay Gap';
                    'Unadjusted Gender Pay Gap'[Job family-ID]
                        & " " & "Female" & " " & 'Unadjusted Gender Pay Gap'[Func];
                    "-"
                )
            );
        IF (
            AND (
                'Unadjusted Gender Pay Gap'[Gender] = "Male";
                LOOKUPVALUE (
                    'Unadjusted Gender Pay Gap'[Total Compensation];
                    'Unadjusted Gender Pay Gap'[Key]; CONCATENATEX (
                        'Unadjusted Gender Pay Gap';
                        'Unadjusted Gender Pay Gap'[Job family-ID]
                            & " " & "Female" & " " & 'Unadjusted Gender Pay Gap'[Func];
                        "-"
                    )
                ) > 0
            );
            'Unadjusted Gender Pay Gap'[Total Compensation]
        )
    )
)


...