Forum Discussion
khisla
Helper II
1 year agoDAX Command - IF variables, SWITCH and COALESCE
I need a DAX commend to identify the store to which an employee is based to sales commission calculation purposes Please find table of specific scenarios and expected results for each one. So I hav...
- 1 year ago
Hello khisla
You added one ) in your second condition in the CASE
Normally, the following measure should workNext= VAR EntranceStore = SELECTEDVALUE('HILAN'[Entrance Store]) VAR ExitStore = SELECTEDVALUE('HILAN'[Exit Store]) VAR DefaultStore = SELECTEDVALUE('HILAN'[Employee Default Store]) RETURN SWITCH( TRUE(), NOT(ISBLANK(EntranceStore)) && EntranceStore <> DefaultStore, EntranceStore, NOT(ISBLANK(ExitStore)) && ExitStore <> DefaultStore, ExitStore, NOT(ISBLANK(EntranceStore)) || EntranceStore = DefaultStore || ISBLANK(ExitStore) || ExitStore = DefaultStore, DefaultStore, DefaultStore )
khisla
Helper II
1 year agoGot an error message
Cookistador
Super User
1 year agoHello khisla
You added one ) in your second condition in the CASE
Normally, the following measure should work
Next=
VAR EntranceStore = SELECTEDVALUE('HILAN'[Entrance Store])
VAR ExitStore = SELECTEDVALUE('HILAN'[Exit Store])
VAR DefaultStore = SELECTEDVALUE('HILAN'[Employee Default Store])
RETURN
SWITCH(
TRUE(),
NOT(ISBLANK(EntranceStore)) && EntranceStore <> DefaultStore, EntranceStore,
NOT(ISBLANK(ExitStore)) && ExitStore <> DefaultStore, ExitStore,
NOT(ISBLANK(EntranceStore)) || EntranceStore = DefaultStore || ISBLANK(ExitStore) || ExitStore = DefaultStore, DefaultStore,
DefaultStore
)