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

Calculate average from calculated values

I have two calculated values and need to have the average and delta between those.

Naamloos.png
 
 

The second value is correct but the first isn't. How can i get the average of that one?

I have this function to get the average of first and last. And a new to get the average of the average.

 

 

GemiddeldeLichaamssamenstellingEerste =
VAR selectie =
    ADDCOLUMNS (
        VALUES ( company[Name] ),
        "EersteWaarde",
            CALCULATE (
                MIN ( usermeasurements[AppointmentId] ),
                FIRSTDATE ( usermeasurements[OnderzoekVerichtOp] ),
                FILTER (
                    usermeasurements,
                    usermeasurements[users.company.Name] = VALUES ( company[Name] )
                )
            )
    )
VAR LS =
    CALCULATE (
        AVERAGE ( usermeasurements[BodyCompositionOverall] ),
        TREATAS (
            selectie,
            usermeasurements[users.company.Name],
            usermeasurements[AppointmentId]
        )
    )
RETURN
    COALESCE ( LS / 10, 0 )
Gemiddelde van GemiddeldeLichaamssamenstellingTweede per BodyCompositionOverall = 
AVERAGEX(
	KEEPFILTERS(VALUES('usermeasurements'[BodyCompositionOverall])),
	CALCULATE([GemiddeldeLichaamssamenstellingEerste])
)

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @DionTN ,

 

If the two values are already calculated measures you need to only do the average of both of them:

 

Average of two values= AVERAGE ([Value1], [Value2])

 

This should get the expected result since the use of metrics within another metrics forces the use of CALCULATE that will make your calculation work properly.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @DionTN ,

 

If the two values are already calculated measures you need to only do the average of both of them:

 

Average of two values= AVERAGE ([Value1], [Value2])

 

This should get the expected result since the use of metrics within another metrics forces the use of CALCULATE that will make your calculation work properly.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.

April Fabric Community Update

Fabric Community Update - April 2024

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