The following syntax entered into a calculated column formula for table Visits provided below in powerpivot in excel (office 365 version):
=GROUPBY(
Visits,
[Patient Name],
"First_Visit_Date",
MINX(CURRENTGROUP(), Visits[Visit_Date])
)
Yields the error:
The expression refers to multiple columns. Multiple columns cannot be
converted to a scalar value.
What is the correct DAX GROUPBY syntax when using PowerPivot embedded in Excel to add a calculated column "First_Visit_Date" to the simple source table Visits table depicted below to arrive at the target table also listed below:
Source Table (Visits):
Patient_Name, Visit_Date, Duration Sue, 8/10/2017, 60 Sue, 8/12/2017, 20 Sue, 8/20/2017, 15 Bill, 9/ 1/2018, 90 Bill, 10/ 1/2018, 90 Sally, 5/22/2016, 30 Sally, 5/30/2016, 30
Target Table:
Patient_Name, Visit_Date, Duration, Calculated Column 1 Sue, 8/10/2017, 60, 8/10/2017 Sue, 8/12/2017, 20, 8/10/2017 Sue, 8/20/2017, 15, 8/10/2017 Bill, 9/ 1/2018, 90, 9/ 1/2018 Bill, 10/ 1/2018, 90, 9/ 1/2018 Sally, 5/22/2016, 30, 5/22/2016 Sally, 5/30/2016, 30, 5/22/2016