Forum Discussion
MillyP
7 years agoRegular Visitor
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....
- 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" ) ) ) )
v-frfei-msft
7 years agoCommunity Support
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"
)
)
)
)
- MillyP7 years agoRegular Visitor
Thank you for your help y-frfei-msft v works perfectly,