Forum Discussion
Convert boolean to scalar value?
- Anonymous6 years ago
Hi edhans ,
You can use SELECTEDVALUE() function instead of MAX() function.
Last Date Is Validated = CALCULATE(SELECTEDVALUE('Table'[Validated] ),FILTER('Table',LASTDATE('Table'[Date])=DATE(2018,2,1)))Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi FrankAT
I have a table that looks like this:
| Date | Validated |
| 1/1/2018 | True |
| 2/1/2018 | False |
If [Validated] was a text field, I could convert it to a scalar value by using the following measure:
Last Date Is Validated =
CALCULATE(
MAX( TableName[Validated] ),
LASTDATE( TableName[Date] )
= DATE( 2018, 2, 1 )
)
That measure would evaluate to True() so I could do something else with that - an IF statement for example. MAX() converted the single record table for that field to a scalar value - or would if [Validated] was a numeric or alphanumeric field.
But MAX doesn't work on a boolean column, so that doesn't work. Trying to see if there is a single function that does work with boolean fields.
Hi edhans ,
You can use SELECTEDVALUE() function instead of MAX() function.
Last Date Is Validated = CALCULATE(SELECTEDVALUE('Table'[Validated] ),FILTER('Table',LASTDATE('Table'[Date])=DATE(2018,2,1)))
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- edhans6 years agoCommunity Champion
Thank you Jay. SELECTEDVALUE() seems to be exactly what I was looking for in this instance.