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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
selected_
Helper IV
Helper IV

Is that possible to measure AVERAGE three times in a single measure?

I'm trying to make a measure like that, how can I correct it?

 

 

Avg ProductID+OrderID = AVERAGEX(VALUES(Products[ProductID]), CALCULATE(AVERAGE('Order Details'[OrderID]), CALCULATE(AVERAGE(Products, Products[UnitPrice]) * (1-[Total Discount]))))

 

 

ERROR Too many arguments were passed to the AVERAGE function. The maximum argument count for the function is 1.

5 REPLIES 5
v-yingjl
Community Support
Community Support

Hi @selected_ ,

Average() only allows one parameter and AverageX() allow two parameter, they are defined by DAX syntax.

Based on your formula, not certain what you want to calculate and what your expected result is, seems need more information about this issue for further discusssion like some sample data, screen shots etc. which can let community members better to help you to solve this issue.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@selected_ , Try like


Avg ProductID+OrderID = AverageX(Summarize('Order Details','Order Details'[OrderID],Products[ProductID], "_1",CALCULATE(AVERAGE(Products, Products[UnitPrice]) * (1-[Total Discount]))),[_1])


Avg ProductID+OrderID = AVERAGEX(VALUES(Products[ProductID]), CALCULATE(AVERAGE(Products, Products[UnitPrice]) * (1-[Total Discount]) Values('Order Details'[OrderID])))

edhans
Super User
Super User

Use this measure @selected_ 

Avg ProductID+OrderID =
AVERAGEX(
    VALUES( Products[ProductID] ),
    CALCULATE(
        AVERAGE( 'Order Details'[OrderID] ),
        CALCULATE(
            AVERAGE( Products[UnitPrice] ) * ( 1 - [Total Discount] )
        )
    )
)

You had this:

AVERAGE(Products, Products[UnitPrice])

You cannot do that, and it was complaining about the two parameters, and AVERAGE() only takes one, a single column. 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans 

 

your code give me error

A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

Yeah, I have no data to test with @selected_ and I am not sure what your formula is even doing. Why is it averaging the order ID for example? 

I just gave you something syntactically correct. Please provide data and what your goal is.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.