This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
This might be a simple question but it is eluding me, short of a longer measure (which I have already created), is there a single function to convert boolean field to a scalar value?
For example, MIN and MAX can be used to convert text and number fields to a scalar value, and FIRSTDATE and LASTDATE will do the same for a date field, but MIN/MAX cannot be use on boolean (TRUE/FALSE) columns.
Scanning through the DAX functions isn't revealing anything.
I don't need a measure to do this. I've already done that. I just wondered if there was a single function to do this like there is for text, numbers, and dates.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingSolved! Go to Solution.
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,
try:
INT ( TRUE() )
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.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingHi @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.
Thank you Jay. SELECTEDVALUE() seems to be exactly what I was looking for in this instance.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingSign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 31 | |
| 25 | |
| 21 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 65 | |
| 41 | |
| 28 | |
| 22 | |
| 22 |