Forum Discussion

Daxmon_23's avatar
Daxmon_23
Frequent Visitor
3 years ago
Solved

From Tableau Fixed function to Power BI DaX

Hi everyone, I am trying to move my reports from Tableau to Power BI and i have some below FIXED function which should be written in DAX. Can any one please help to convert Tableau LOD to Power BI ...
  • v-henryk-mstf's avatar
    3 years ago

    Hi Daxmon_23 ,

     

    Change your formula like below:

    Cump =
    VAR a =
        SWITCH (
            TRUE (),
            [Precio Prom] < 450, "0-$450",
            AND ( [Precio Prom] > 450, [Precio Prom] <= 550 ), "$500",
            AND ( [Precio Prom] > 550, [Precio Prom] <= 650 ), "$600",
            [Precio Prom] >= 600, "More than $600"
        )
    RETURN
        CALCULATE (
            a,
            ALLEXCEPT ( Sales, Sales[UniqueID] ),
            ALLEXCEPT ( Product, Product[Categories] )
        )

    or maybe:

    Cump =
    VAR a =
        SWITCH (
            TRUE (),
            MAX ( DimProduct[Color] ) = "Red", "red",
            AND (
                MAX ( DimProduct[Color] ) = "Black",
                ( MAX ( DimProduct[Color] ) = "Grey" )
            ), "grey",
            "Other color"
        )
    RETURN
        CALCULATE ( a, ALLEXCEPT ( DimDate, DimDate[FiscalYear] ) )

     

    If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


    Best Regards,
    Henry


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