Forum Discussion

MillyP's avatar
MillyP
Regular Visitor
7 years ago
Solved

Need help adding to a dax query

Hi Guys, I have a  calculation on Power BI that now needs to be changed/added to as the calculation it by using a date to calculate the results, I am really struggling trying to update this measure....
  • v-frfei-msft's avatar
    7 years ago

    Hi MillyP ,

     

    To create a combined one as below.

    NPS_Score = 
    IF (
        ISBLANK ( 'NPS_Data'[String Value] ),
        "Blank",
        IF (
            NPS_Data[Updated] <= DATE ( 2019, 05, 11 ),
            SWITCH (
                TRUE (),
                'NPS_Data'[String Value] >= 0
                    && 'NPS_Data'[String Value] <= 6, "Detractors",
                'NPS_Data'[String Value] = 7
                    || 'NPS_Data'[String Value] = 8, "Passives",
                'NPS_Data'[String Value] = 9
                    || 'NPS_Data'[String Value] = 10, "Promoters"
            ),
            IF (
                NPS_Data[Updated] >= DATE ( 2019, 05, 11 ),
                SWITCH (
                    TRUE (),
                    'NPS_Data'[String Value] >= 0
                        && 'NPS_Data'[String Value] <= 2, "Detractors",
                    'NPS_Data'[String Value] = 3, "Passives",
                    'NPS_Data'[String Value] = 4
                        || 'NPS_Data'[String Value] = 5, "Promoters"
                )
            )
        )
    )