Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
DionTN
Helper II
Helper II

Use function for entire table.

I have a table with all measurements of all people. Its based out of Company names and normal names. In the first function I want to get a list of alle people from a selected company with the lowest apointmentNumber.

DionTN_0-1660639846459.png

This list is calculated with the folowing function:

 

 

FirstValue =
VAR selectie =
    SELECTEDVALUE ( company[Name] )
VAR EersteWaarde =
    CALCULATE (
        MIN ( usermeasurements[AppointmentId] ),
        FIRSTDATE ( usermeasurements[OnderzoekVerichtOp] ),
        FILTER ( usermeasurements, usermeasurements[users.company.Name] = selectie )
    )
RETURN
    EersteWaarde

 

 

In this part  I want to select all first values from the selected Company. This part is only working when I connect this function with a name list of the company. I want to use all first values in the folowing function to calculate some output:

 

 

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 )

 

So i want the table as mentioned earlier as input to calculate some averages of that selection (so the given apointmentID's)

DionTN_0-1660640190567.png

This is the result I want. So some selected names and FirstValues. From those Values I need to calculate some averages.

How can I deal with this?

3 REPLIES 3
daXtreme
Solution Sage
Solution Sage

Hi @DionTN 

 

I'm not able to follow this. Would you mind if you rephrased the question, please? It would also be nice if you could format the code properly (www.daxformatter.com) before pasting. It's almost impossible to read this as it is right now. If you could paste some pictures of what it is you want, that would also help.

 

Thanks.

I changed my question. Hopefully you can help me.

@daXtremeCan you do something with it?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors