Hi there, I got it to work
For the Target expression, I used a Switch measure to choose the selected measure
SWITCH( TRUE(),
[Metric Selected] = “Revenue”, [AVG Daily Sales Overall],
[Metric Selected] = “Costs”, [AVG Daily Costs Overall],
[Metric Selected] = “Profits”, [AVG Daily Profits Overall], [Total Sales])
For the Status, I again used Switch
VAR DailySales = [Total Sales]
VAR DailyCosts = [Total Costs]
VAR DailyProfits = [Total Profits]
VAR SalesTolerance = 0.02
VAR SalesGoal = [_Total Sales Goal]
VAR CostsGoal = [_Total Costs Goal]
VAR ProfitsGoal = [_Total Profits Goal]
RETURN
SWITCH (
TRUE (),
[Metric Selected] = “Revenue”,
IF (
NOT ISBLANK ( DailySales ),
SWITCH (
TRUE,
DailySales < SalesGoal - SalesTolerance, -1,
DailySales > SalesGoal + SalesTolerance, 1,
0
)
),
[Metric Selected] = “Costs”,
IF (
NOT ISBLANK ( DailyCosts ),
SWITCH (
TRUE,
DailyCosts < CostsGoal - SalesTolerance, 1,
DailyCosts > CostsGoal + SalesTolerance, -1,
0
)
),
[Metric Selected] = “Profits”,
IF (
NOT ISBLANK ( DailyProfits ),
SWITCH (
TRUE,
DailyProfits < ProfitsGoal - SalesTolerance, -1,
DailyProfits > ProfitsGoal + SalesTolerance, 1,
0
)
)
)
and for the Trend:
VAR TotalSales = [Total Sales]
VAR PrevSales =
CALCULATE ( [Total Sales], PREVIOUSDAY ( ‘Dates’[Date] ) )
VAR TotalProfits = [Total Profits]
VAR PrevProfits =
CALCULATE ( [Total Profits], PREVIOUSDAY ( ‘Dates’[Date] ) )
VAR TotalCosts = [Total Costs]
VAR PrevCosts =
CALCULATE ( [Total Costs], PREVIOUSDAY ( ‘Dates’[Date] ) )
RETURN
SWITCH (
TRUE (),
[Metric Selected] = “Revenue”,
IF (
NOT ISBLANK ( TotalSales ) && NOT ISBLANK ( PrevSales ),
SWITCH (
TRUE,
TotalSales > PrevSales, 1,
– Negative
TotalSales < PrevSales, -1,
– Positive
0
)
),
[Metric Selected] = “Costs”,
IF (
NOT ISBLANK ( TotalCosts ) && NOT ISBLANK ( PrevCosts ),
SWITCH (
TRUE,
TotalCosts > PrevCosts, 1,
– Negative
TotalCosts < PrevCosts, -1,
– Positive
0
)
),
[Metric Selected] = “Profits”,
IF (
NOT ISBLANK ( TotalProfits ) && NOT ISBLANK ( PrevProfits ),
SWITCH (
TRUE,
TotalProfits > PrevProfits, 1,
– Negative
TotalProfits < PrevProfits, -1,
– Positive
0
)
)
)