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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors