Forum Discussion
Different Datatype under same Column
- 4 years ago
Hi RilwanFlame,
There is no way a column can have multiple data type. If it is a mix, it will usually end up a Text as data type.
But you can hack it using DAX by adding switch statements for different cases where you need different units, and you have to hard code them.
Check this example:
And this is the measure:SWITCH =
VAR A = SELECTEDVALUE('Sales Territories'[Country])
RETURN
SWITCH(
TRUE(),
SELECTEDVALUE('Sales Territories'[Country]) = "Canada", [Percentage] * 100 & "%",
SELECTEDVALUE('Sales Territories'[Country]) = "Australia", "$" & [Total Sales]
)If you want to do this, you need to separate your column with mixed data types into multiple columns with different types, or else you cannot aggregate the columns to create a measure.
Hi RilwanFlame,
There is no way a column can have multiple data type. If it is a mix, it will usually end up a Text as data type.
But you can hack it using DAX by adding switch statements for different cases where you need different units, and you have to hard code them.
Check this example:
And this is the measure:
SWITCH =
VAR A = SELECTEDVALUE('Sales Territories'[Country])
RETURN
SWITCH(
TRUE(),
SELECTEDVALUE('Sales Territories'[Country]) = "Canada", [Percentage] * 100 & "%",
SELECTEDVALUE('Sales Territories'[Country]) = "Australia", "$" & [Total Sales]
)
If you want to do this, you need to separate your column with mixed data types into multiple columns with different types, or else you cannot aggregate the columns to create a measure.