Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
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!
Position | PL | Day Code |
D | 310 | Game |
D | 313 | Game |
D | 326 | Game |
D | 403 | Game |
D | 332 | Game |
D | 382 | Game |
D | 332 | Game |
D | 370 | Game |
D | 367 | Game |
D | 348 | Game |
D | 321 | Game |
D | 394 | Game |
D | 329 | Game |
D | 325 | Game |
D | 327 | Game |
D | 294 | Game |
D | 339 | Game |
D | 341 | Game |
D | 315 | Game |
D | 300 | Game |
D | 375 | Game |
D | 229 | Game |
D | 357 | Game |
D | 319 | Game |
D | 375 | Game |
D | 326 | Game |
D | 421 | Game |
D | 340 | Game |
Solved! Go to Solution.
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:
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:
_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❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
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:
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:
_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❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
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.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
108 | |
108 | |
92 | |
67 |
User | Count |
---|---|
161 | |
129 | |
129 | |
92 | |
91 |