Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have created a measure using the calculate function, it does not override the row context of the Attainment and always just returns the row total (see left hand table in linked page) I'm just starting out with Power BI and this is driving me insane I don't understand why this is happening.
Solved! Go to Solution.
Hi Parvinder, Ken,
I have solved my problem, It was similar to this problem here https://www.sqlbi.com/daxpuzzle/unexpected-filter-behavior-in-calculate/ and I sorted it by adding an explicit all to the calculate function for the attainment index column I was using to sort the attainment:
Thanks for your time.
To override the filter context for the row you will need to add an All to your calculate
TotalAttainment = CALCULATE([Pupil Count],ALL(Sheet1[Pupil Count]),Sheet1[Attainment]<>"No Data")
There are many resources for learning. I would recommend https://www.sqlbi.com/ they explain EVERYTHING. Power BI looks sort of like Excel or SQL queries, but that is an illusion. It has its own rules. They are not that hard to learn, but, for me at least, it was hard to wrap my head around a whole different way of approaching data.
Help when you know. Ask when you don't!
Hi Ken,
I've been watching (and rewatching) the Advanced DAX video from the SQL BI guys this afternoon. I couldn't get the syntax you suggested to work, the all function wouldn't accept Pupil Count as an argument, maybe it wasn't clear it was a measure rather than a column. I have tried incorporating All into that formula without success, I think I just passed ALL(Sheet1) as the second argument in CALCULATE but it had the same result.
I feel you.
Could you provide a small set of sample data.
You can just copy and paste into one of these replies from power bi or excel.
That may let me give you more specific advice.
Thanks
Ken
Help when you know. Ask when you don't!
@bobby27 something obvious is missing, share pbix file wiht sample data, remove sensitive info before sharing. you can also send it by email, my email is in the signature.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi Parvinder, Ken,
I have solved my problem, It was similar to this problem here https://www.sqlbi.com/daxpuzzle/unexpected-filter-behavior-in-calculate/ and I sorted it by adding an explicit all to the calculate function for the attainment index column I was using to sort the attainment:
Thanks for your time.
@bobby27 What is your table relationship? What is pupil count measure? your measure should work, need more info to further debug it.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks for your post, Pupil Count is COUNTA([PupilUPN]) (with UPN being a ID field for pupil), there aren't any table joins in PBI, since I'm just passing a SQL statement that returns the table. There are no other filters etc, and 404 records is the full amount in the table after records were filtered in query editor.
So left table:
Attainment conditional column defined in query editor
Pupil Count = COUNTA([PupilUPN])
Right table:
Grade - straight from dataset item DL_Result
Pupil Count = COUNTA([PupilUPN])
User | Count |
---|---|
97 | |
78 | |
77 | |
48 | |
26 |