Forum Discussion
alya1
2 years agoHelper V
Return column name if data matches another column data in same row (or MIN value- select column)
Hello, I have table such as below: Start Date Date 1 Date 2 Date 3 Date 4 Date 5 (DAX new column) Earliest Date 1/1/20 1/3/23 1/3/23 1/3/23 5/5/20 9/9/23 ...
- 2 years ago
Hi,
I am not sure when you are getting this error, however I have added a row with all the Date 1 - Date 5 as blank and modified the 2nd measure a little to show the value:Min_Date_Col =VAR _x = ""VAR _dt1 =IF([Min_Date] = VALUES(Earliest_Date[Date 1 ]), "Date1, ")VAR _dt2 =IF([Min_Date] = VALUES(Earliest_Date[Date 2 ]), "Date2, ")VAR _dt3 =IF([Min_Date] = VALUES(Earliest_Date[Date 3 ]), "Date3, ")VAR _dt4 =IF([Min_Date] = VALUES(Earliest_Date[Date 4 ]), "Date4, ")VAR _dt5 =IF([Min_Date] = VALUES(Earliest_Date[Date 5 ]), "Date5, ")VAR _returnText =_dt1 & _dt2 & _dt3 & _dt4 & _dt5RETURNIF(ISBLANK([Min_Date]),"",LEFT(_returnText,LEN(_returnText)-2))If this resolves your problem, then please accept this as solution, Thanks!
samratpbi
2 years agoSuper User
Hi,
I am not sure when you are getting this error, however I have added a row with all the Date 1 - Date 5 as blank and modified the 2nd measure a little to show the value:
Min_Date_Col =
VAR _x = ""
VAR _dt1 =
IF([Min_Date] = VALUES(Earliest_Date[Date 1 ]), "Date1, ")
VAR _dt2 =
IF([Min_Date] = VALUES(Earliest_Date[Date 2 ]), "Date2, ")
VAR _dt3 =
IF([Min_Date] = VALUES(Earliest_Date[Date 3 ]), "Date3, ")
VAR _dt4 =
IF([Min_Date] = VALUES(Earliest_Date[Date 4 ]), "Date4, ")
VAR _dt5 =
IF([Min_Date] = VALUES(Earliest_Date[Date 5 ]), "Date5, ")
VAR _returnText =
_dt1 & _dt2 & _dt3 & _dt4 & _dt5
RETURN
IF(
ISBLANK([Min_Date]),
"",
LEFT(_returnText,LEN(_returnText)-2)
)
If this resolves your problem, then please accept this as solution, Thanks!
alya1
2 years agoHelper V
Hello, thank you for the update! I did a few treaks on your DAX and it came out beautifully! much appreciated samratpbi!