Forum Discussion
SWITCH DAX returning both text and numeric values — numeric values show left-aligned as text
Hi everyone,
I created a SWITCH DAX measure that returns a mix of text and numeric values depending on conditions.
Example:
Result =
SWITCH(
TRUE(),
Table[Status] = "A", "Approved",
Table[Status] = "P", "Pending",
Table[Status] = "N", 1200,
Table[Status] = "X", 980,
BLANK()
)
The measure works, but Power BI treats the entire column as text, so numeric values appear left-aligned and behave like text.
I tried using FORMAT() and changing visual alignment, but I want a solution where numeric values appear right-aligned like numbers while still keeping text for other conditions.
Is there any way to:
Keep the mixed output from SWITCH, and
Make numeric values display as numeric (right-aligned) in the same column?
Any ideas or workarounds would be appreciated!
5 Replies
- AhmedxSuper User
- AhmedxSuper User
If you do this as a calculated column, it won't work. Power BI doesn't support two data types for columns.
- v-achippaCommunity Support
Hi Mahendra_k,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Ahmedx for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
- v-achippaCommunity Support
Hi @Mahendra_k,
We wanted to kindly follow up to check if the solution provided by the user for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
- PhilipTreacySuper User
Not sure what is happening with your measure but when I create it, everything is right aligned. And the values stay either text or numeric
Phil