Forum Discussion

kasai16's avatar
kasai16
Regular Visitor
2 years ago
Solved

Tableau calculation to power bi

Can someone help me to convert below Tableau calculation field or formulla to Power Bi....   IF ATTR([Column Name])!="Column Value" THEN IF (ZN([Parameter A]) - LOOKUP(ZN([Parameter A]), FIRST())) ...
  • VN999's avatar
    2 years ago

    Try with below Dax code and compare the output results b/w Tableau and Power Bi Calculated columns.

    Result =
    IF (
    NOT(ISBLANK('Table'[Column Name])) && 'Table'[Column Name] <> "Column Value",
    VAR ParameterA = 'Table'[Parameter A]
    VAR FirstParameterA = CALCULATE(
    FIRSTNONBLANK('Table'[Parameter A], 1),
    FILTER(ALL('Table'), 'Table'[Column Name] <> "Column Value")
    )
    RETURN
    IF (
    ParameterA <> BLANK() && FirstParameterA <> BLANK() && FirstParameterA <> 0,
    (ParameterA - FirstParameterA) / ABS(FirstParameterA),
    BLANK()
    )
    )

     

    Replace with PowerBI table names and columns.