The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Experts, please help me to fix the below DAX.
Solved! Go to Solution.
Hi @Anonymous ,
1.Assume the Type columm is Number type, please try:
Type Description =
SWITCH (
TRUE (),
'Accrual View'[Type] = 11, "Carry Forward",
'Accrual View'[Type] = 2, "Earned",
'Accrual View'[Type] = 1, "Sick",
CONVERT( 'Accrual View'[Type],STRING)
)
2. Text type:
Description =
SWITCH ( [Type], "1", "Sick", "2", "Earned", "11", "Carry Forward", [Type] )
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
1.Assume the Type columm is Number type, please try:
Type Description =
SWITCH (
TRUE (),
'Accrual View'[Type] = 11, "Carry Forward",
'Accrual View'[Type] = 2, "Earned",
'Accrual View'[Type] = 1, "Sick",
CONVERT( 'Accrual View'[Type],STRING)
)
2. Text type:
Description =
SWITCH ( [Type], "1", "Sick", "2", "Earned", "11", "Carry Forward", [Type] )
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
If you are trying to create a new column, please try something like below.
Type Description =
SWITCH (
TRUE (),
'Accrual View'[Type] = 11, "Carry Forward",
'Accrual View'[Type] = 2, "Earned",
'Accrual View'[Type] = 1, "Sick",
'Accrual View'[Type]
)
hi @Anonymous @what type of data do you have for the [type] column
It was Number, I changed to text.
the code compares it with number, so it needs to be numbers.