Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
21 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |