Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am create a new column to do an If statement. I did use DAX Formatter to use it. The code is working. But i am wondering is there any better way to do it.
Solved! Go to Solution.
Hi @Anonymous
Its not a Power Query, its a DAX question, as I see
Anyway, try Switch function https://docs.microsoft.com/en-us/dax/switch-function-dax like
Sub Group Seq Date =
SWITCH(
DRIVE_In_Scope_Unit_List[Sub Group Sequence E2E] ;
"1";"12/01/2018";
"2";"02/01/2019";
"3";"03/01/2019";
"Unknown number"
)
do not hesitate to give a kudo to useful posts and mark solutions as solution
Thank you @az38. You code is almost right need to replace ";" to "," and then i can run it.
Sub Group Seq Date =
SWITCH (
DRIVE_In_Scope_Unit_List[Sub Group Sequence E2E],
"1", "12/01/2018",
"2", "02/01/2019",
"3", "03/01/2019",
"4", "03/01/2019",
"5", "04/01/2019",
"6", "04/01/2019",
"7", "05/01/2019",
"8", "06/01/2019",
"9", "06/01/2019",
"10", "07/01/2019",
"11", "07/01/2019",
"12", "07/01/2019",
"13", "08/01/2019",
"14", "08/01/2019",
"15", "08/01/2019",
"16", "09/01/2019",
"17", "09/01/2019",
"18", "09/01/2019",
"19", "09/01/2019",
"20", "09/01/2019",
"21", "10/01/2019",
"22", "10/01/2019",
"999", "10/01/2019",
"11/01/2019"
)
Hi @Anonymous
Its not a Power Query, its a DAX question, as I see
Anyway, try Switch function https://docs.microsoft.com/en-us/dax/switch-function-dax like
Sub Group Seq Date =
SWITCH(
DRIVE_In_Scope_Unit_List[Sub Group Sequence E2E] ;
"1";"12/01/2018";
"2";"02/01/2019";
"3";"03/01/2019";
"Unknown number"
)
do not hesitate to give a kudo to useful posts and mark solutions as solution
Thank you @az38. You code is almost right need to replace ";" to "," and then i can run it.
Sub Group Seq Date =
SWITCH (
DRIVE_In_Scope_Unit_List[Sub Group Sequence E2E],
"1", "12/01/2018",
"2", "02/01/2019",
"3", "03/01/2019",
"4", "03/01/2019",
"5", "04/01/2019",
"6", "04/01/2019",
"7", "05/01/2019",
"8", "06/01/2019",
"9", "06/01/2019",
"10", "07/01/2019",
"11", "07/01/2019",
"12", "07/01/2019",
"13", "08/01/2019",
"14", "08/01/2019",
"15", "08/01/2019",
"16", "09/01/2019",
"17", "09/01/2019",
"18", "09/01/2019",
"19", "09/01/2019",
"20", "09/01/2019",
"21", "10/01/2019",
"22", "10/01/2019",
"999", "10/01/2019",
"11/01/2019"
)
@Anonymous
the correct symbol ";" or ",' is depends on system localization.
Good luck!
do not hesitate to give a kudo to useful posts and mark solutions as solution
Hi @Anonymous
if solution is ok, please mark it as solution for future users with the same problem
thanks