cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rgadbois
Frequent Visitor

Incorrect Avg

Hi,

 

I am attempting to calculate an measure for an average based on 2 criteria within separate columns. I want to filter by position, and by day code as seen below. I want to filter by position "D" and day code "Game". The result I expect is 340, which is also the average shown in PowerQuery when filtering rows by these 2 criteria, though the measure I am using shows "345". Any assistance with this would be great. Thank you!

 

Note - I have tried numerous iterations of CALCULATE, with these 2 filters, COUNTROWS, and similar functions but all produce the exact same result, which is incorrect. Any additional insight into how DAX is calculating this average, whereas PowerQuery shows the value I expect being different from the calculation, it would be greatly appreciated!

 

_Forwards Game PL =
CALCULATE(AVERAGE(
    Catapult[PL]),
    FILTER(ALL(Catapult),Catapult[Day Code] = "Game" && Catapult[Position Name] = "F"
    )
 )

Position

PL

Day Code

D310Game
D313Game
D326Game
D403Game
D332Game
D382Game
D332Game
D370Game
D367Game
D348Game
D321Game
D394Game
D329Game
D325Game
D327Game
D294Game
D339Game
D341Game
D315Game
D300Game
D375Game
D229Game
D357Game
D319Game
D375Game
D326Game
D421Game
D340Game
 
EDIT: I have also just tried the average for the entire column without any filters and get an incorrect value. Why does PowerBI do this??? This is extremly frustrating as I am beginning to question data integrity from PowerBi. Thank you!
1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @rgadbois ,

 

I used your measure as posted in your question. Note, I changed Position from "F" to "D" because "D" was the only value that you provided in your sample data:

tomfox_0-1665162016062.png

 

 

As you can see, I get the 340. Could it be that you just used the wrong letter? Otherwise, I think your DAX looks good 🙂 Here another way of writing it:

 

tomfox_1-1665162172309.png

_Forwards Game PL = 
CALCULATE ( AVERAGE ( tabell[PL] ), tabell[Day Code] = "Game" && tabell[Position] = "D" )

 

 

Hope this helps!

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @rgadbois ,

 

I used your measure as posted in your question. Note, I changed Position from "F" to "D" because "D" was the only value that you provided in your sample data:

tomfox_0-1665162016062.png

 

 

As you can see, I get the 340. Could it be that you just used the wrong letter? Otherwise, I think your DAX looks good 🙂 Here another way of writing it:

 

tomfox_1-1665162172309.png

_Forwards Game PL = 
CALCULATE ( AVERAGE ( tabell[PL] ), tabell[Day Code] = "Game" && tabell[Position] = "D" )

 

 

Hope this helps!

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/





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

Proud to be a Super User!




Thank you! I knew I wasn't crazy. Sorry for the error on that letter, I am doing this for both forwards and defensemen. I had ensured I entered the correct letter in PowerBI for this instance as well. I also just tried taking the average for the entire column with no filters and saw that it was also incorrect. Any possible insight as to why this may be the case?

 

NOTE - I do get the correct value on a blank page.... but when I add this measure as a card on a page with visuals, but NO page filters, the value is incorrect.

Helpful resources

Announcements
collabdays lisbon

CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.