Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Im trying to get a mean for every first measurement. So i have a function which calculates all the first measurements. I want to use this to get the mean of all first measurements.
GemiddeldeLichaamssamenstellingEerste = var selectie = SELECTEDVALUE(company[Name]) var EersteWaarde = CALCULATE(MIN(usermeasurements[AppointmentId]),FIRSTDATE(usermeasurements[OnderzoekVerichtOp])) var LS = CALCULATE(AVERAGE(usermeasurements[BodyCompositionOverall]),FILTER(usermeasurements,usermeasurements[users.company.Name] = selectie), (usermeasurements[appointments.AppointmentNumber]= EersteWaarde)) return COALESCE(LS/10,0)
When i select just 1 name it is working, but when i select a couple of names it fails.
Solved! Go to Solution.
Im sorry, the mistake was probably in the defination of FirstValue.
It reads only the lowest firstValue. So in this example, only richard will get a score cause of he has appointmentID 1
FirstValue = var selectie = SELECTEDVALUE(company[Name]) var EersteWaarde = CALCULATE(MIN(usermeasurements[AppointmentId]),FIRSTDATE(usermeasurements[OnderzoekVerichtOp]), FILTER(usermeasurements,usermeasurements[users.company.Name] = selectie)) return EersteWaarde
SELECTEDVALUE only work when there is a single value, otherwise it will return blank. Try
GemiddeldeLichaamssamenstellingEerste =
VAR selectie =
ADDCOLUMNS (
VALUES ( company[Name] ),
"EersteWaarde",
CALCULATE (
MIN ( usermeasurements[AppointmentId] ),
FIRSTDATE ( usermeasurements[OnderzoekVerichtOp] )
)
)
VAR LS =
CALCULATE (
AVERAGE ( usermeasurements[BodyCompositionOverall] ),
TREATAS (
selectie,
usermeasurements[users.company.Name],
usermeasurements[appointments.AppointmentNumber]
)
)
RETURN
COALESCE ( LS / 10, 0 )
Im sorry, the mistake was probably in the defination of FirstValue.
It reads only the lowest firstValue. So in this example, only richard will get a score cause of he has appointmentID 1
FirstValue = var selectie = SELECTEDVALUE(company[Name]) var EersteWaarde = CALCULATE(MIN(usermeasurements[AppointmentId]),FIRSTDATE(usermeasurements[OnderzoekVerichtOp]), FILTER(usermeasurements,usermeasurements[users.company.Name] = selectie)) return EersteWaarde
User | Count |
---|---|
16 | |
15 | |
14 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
10 |