<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Remove a single filter from a table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897163#M8117</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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....&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;A href="https://personalpowerbitrainer.com/" target="_blank"&gt;I'm a personal Power Bi Trainer&lt;/A&gt;&lt;EM&gt; I learn something every time I answer a question&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The Golden Rules for Power BI&lt;/EM&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. &lt;A href="https://www.youtube.com/watch?v=FxiAYGbCfAQ" target="_blank"&gt;https://www.youtube.com/watch?v=FxiAYGbCfAQ&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;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! &lt;A href="https://www.youtube.com/watch?v=1Kilya6aUQw" target="_blank"&gt;https://www.youtube.com/watch?v=1Kilya6aUQw&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;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.&lt;/LI&gt;&lt;LI&gt;Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result &amp;nbsp;to check on your steps along the way.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Jan 2020 14:14:17 GMT</pubDate>
    <dc:creator>kentyler</dc:creator>
    <dc:date>2020-01-12T14:14:17Z</dc:date>
    <item>
      <title>Remove a single filter from a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897094#M8108</link>
      <description>&lt;P&gt;I'm trying to remove just one filter (from the filter pane) from a table below.&amp;nbsp; There are other filters from slicers that I would like to keep, thus I can't use ALL.&amp;nbsp; I suppose I could use ALLEXCEPT but then I would have to name all the filters I'd like to keep (which will be all except one).&amp;nbsp; Is there a simpler way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Att Taken = 
//Unfilter just the IsAbsenceTaken column in the Attendance table, this is the line that I can't figure out
var AttendanceUnfiltered = FILTER(Attendance,ALL(Attendance[IsAbsenceTaken]))

//Build a summary table
var SummaryTable = SUMMARIZE(AttendanceUnfiltered,
                            Attendance[CourseGroupKey],
                            Attendance[date],
                            Attendance[period],
                            "IsAttendanceTaken",MAX(Attendance[IsAbsenceTaken])
                                )
RETURN
//return the percentage of periods in which attendance was taken
SUMX(SummaryTable,[IsAttendanceTaken]) / COUNTROWS(SummaryTable)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SOLUTION:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm putting the solution here, both answers below led me to it (I accepted the chronologically first one as the answer):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 1&lt;/STRONG&gt;: Create a calculated column (CourseGroupDatePeriodKey) with the columns I was passing into SUMMARIZE above.&amp;nbsp; The calculated column is a single column which then allows me to use DISTINCTCOUNT.&amp;nbsp; DISTINCTCOUNT can be wrapped in CALCULATE which can change the filter context.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Att Taken = 

//count of distinct number of course groups, dates and periods (class sessions).  Clear the IsAbsenceTaken filter in the calculate statement
var AllClassSessions = CALCULATE(DISTINCTCOUNT(Attendance[CourseGroupDatePeriodKey]),ALL(Attendance[IsAbsenceTaken]))

//count of class sessions where attendance was taken
var AttendanceTaken =  CALCULATE(DISTINCTCOUNT(Attendance[CourseGroupDatePeriodKey]),Attendance[IsAbsenceTaken] = 1)


RETURN
// divide class sessions in which attendance was taken by all class sessions.
AttendanceTaken / AllClassSessions&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 2&lt;/STRONG&gt;: Create a new calculated table for periods as suggested in the second reply. (Actually, I ended up creating this in the database rather than in Power BI but it could be done with a calculated table).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This table links to the main fact table using the CourseGroupDatePeriodKey column created in solution 1 above, with a bidirectional relationship.&amp;nbsp; Anything I filter with slicers on the main fact table is thus also filtered in the new table.&amp;nbsp; I then change the filter context using CALCULATE such that all rows are taken into account &lt;SPAN&gt;(ALL(AttTaken[IsAbsenceTaken]):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Att Taken 2 = 
var AttendanceTaken= CALCULATE(COUNTROWS(AttTaken),AttTaken[IsAbsenceTaken] = 1)
var AllClassSessions = CALCULATE(COUNTROWS(AttTaken),ALL(AttTaken[IsAbsenceTaken]))

RETURN
AttendanceTaken / AllClassSessions&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I wanted to keep the model as simple star schema so that I can use bidirectional filters without introducing ambiguity.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 10:20:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897094#M8108</guid>
      <dc:creator>michaelccdf</dc:creator>
      <dc:date>2020-01-15T10:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a single filter from a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897162#M8116</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if you use calculate with all(columnname) then you release the filter on the column. (Only CALCULATE and CALCULATETABLE change the filter context)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so it would be something like:&lt;BR /&gt;calculate( "your calculation" like max(A) or sum(B),&lt;/P&gt;&lt;P&gt;All(columnname)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/dax/calculate-function-dax" target="_self"&gt;https://docs.microsoft.com/en-us/dax/calculate-function-dax&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jan 2020 14:11:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897162#M8116</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-12T14:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a single filter from a table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897163#M8117</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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....&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;A href="https://personalpowerbitrainer.com/" target="_blank"&gt;I'm a personal Power Bi Trainer&lt;/A&gt;&lt;EM&gt; I learn something every time I answer a question&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The Golden Rules for Power BI&lt;/EM&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. &lt;A href="https://www.youtube.com/watch?v=FxiAYGbCfAQ" target="_blank"&gt;https://www.youtube.com/watch?v=FxiAYGbCfAQ&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;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! &lt;A href="https://www.youtube.com/watch?v=1Kilya6aUQw" target="_blank"&gt;https://www.youtube.com/watch?v=1Kilya6aUQw&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;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.&lt;/LI&gt;&lt;LI&gt;Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result &amp;nbsp;to check on your steps along the way.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jan 2020 14:14:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-a-single-filter-from-a-table/m-p/897163#M8117</guid>
      <dc:creator>kentyler</dc:creator>
      <dc:date>2020-01-12T14:14:17Z</dc:date>
    </item>
  </channel>
</rss>

