Forum Discussion
Remove a single filter from a table
- Anonymous6 years ago
Hi,
if you use calculate with all(columnname) then you release the filter on the column. (Only CALCULATE and CALCULATETABLE change the filter context)
so it would be something like:
calculate( "your calculation" like max(A) or sum(B),All(columnname)
)https://docs.microsoft.com/en-us/dax/calculate-function-dax
I'm not clear on what you mean by "simpler". It seems like ALLEXCEPT is designed explicitly to do what you need to do. There is no parallel function like REMOVEFILTER() that would just remove one filter.
Your desire for "simplification" may be linked to some issue that makes you data model "complicated" that is coming out when you try to write this code.
Perhaps if your data model had one table for ROLL, that is, the students who where expected to attend, and another for ACTUALATTENDENCE, which recorded the students from ROLL who actually attended, then you would no need the "isAbsenceTaken" flag. This would change a lot about how you calculated attendance....
Another possibility that this issue might point to is that taking attendance for "Periods" where attendance is taken for some periods and not for others might mean "Period" is a FACT table and not a DIMENSION of attendance. and the flag "IsAbsenceTaken" really applies to a period and not to a student (since it is probably not a question you would ask about each student in a period, but about the period as a whole).
If you'd like to talk over your data model send me an email, with a day and time that suits you, and I'd be glad to take a look with you in a screen share.
I'm a personal Power Bi Trainer I learn something every time I answer a question
The Golden Rules for Power BI
- Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
- Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
- Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.
- Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result to check on your steps along the way.