Hi Waseem,
You should keep logic of < or > and DO NOT mix it. so:
ProjMarginLegend =
SWITCH(TRUE(),
[ProjMargin] < 0, "<0",
[ProjMargin] < 0.10, "0 to <10%",
[ProjMargin] < 0.15, "10% to <15%",
">15%"
),
or
ProjMarginLegend =
SWITCH(TRUE(),
[ProjMargin] > 0.15, ">15%",
[ProjMargin] > 0.10, "10% to <15%",
[ProjMargin] >= 0, "0 to <10%",
"<0"),
Regards
------------------------------
Adam Artur Boltryk
Business Analyst
------------------------------
Original Message:
Sent: Jan 05, 2023 04:18 PM
From: Waseem Dar
Subject: Using Switch formula in the table as a new column
Hello BI community - I added a column by right clicking on the table in Report view. The formula isProjMarginLegend = SWITCH(TRUE(),[ProjMargin] < 0, "<0", [ProjMargin] > 0.15, ">15%", "0 to <15%"). When I change it toProjMarginLegend = SWITCH(TRUE(),[ProjMargin] < 0, "<0", [ProjMargin] >0 and < 0.10, "0 to <10%", [ProjMargin] >=0.10 and < 0.15, "10% to <15%", [ProjMargin] > 0.15, ">15%",""), the formula does not work. Help is appreciated. Thanks
------------------------------
Waseem Dar
Business Analyst
------------------------------