<?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 filter does not work when columns are not selected in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233019#M167412</link>
    <description>&lt;P&gt;I have the following filter created&lt;/P&gt;&lt;P&gt;filter_dates_general =&lt;BR /&gt;VAR result =&lt;BR /&gt;IF(&lt;/P&gt;&lt;P&gt;SELECTEDVALUE(fct_revenue[Start_Date])&amp;gt;= MIN(dim_calendar[Date])&lt;BR /&gt;&amp;amp;&amp;amp;SELECTEDVALUE(fct_revenue[Start_Date])&amp;lt;=MAX(dim_calendar[Date])&lt;BR /&gt;||&lt;BR /&gt;SELECTEDVALUE(fct_revenue[End_Date])&amp;gt;= MIN(dim_calendar[Date])&lt;BR /&gt;&amp;amp;&amp;amp;SELECTEDVALUE(fct_revenue[End_Date])&amp;lt;=MAX(dim_calendar[Date])&lt;BR /&gt;||&lt;BR /&gt;SELECTEDVALUE(fct_revenue[Start_Date])&amp;lt;= MIN(dim_calendar[Date])&lt;BR /&gt;&amp;amp;&amp;amp;SELECTEDVALUE(fct_revenue[End_Date])&amp;gt;=MAX(dim_calendar[Date]),&lt;/P&gt;&lt;P&gt;1,&lt;BR /&gt;0)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;RETURN result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and a between slicer based on date.&lt;/P&gt;&lt;P&gt;i removed the relationship between fct_revenue and dim_calendar for this&lt;/P&gt;&lt;P&gt;when i have a table with region, absence_code, start_date, end_date, and above filter =1&lt;/P&gt;&lt;P&gt;this filter works fine and is showing all regions which fullfil above formula. so within the date range. or even when start and end date are the same its working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if i create a piechart based on only absence_code its not working anymore because start and end _date are not within the context anymore..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what to do are to adjust that above filter is working for every dimension within dashboard?&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;</description>
    <pubDate>Tue, 08 Oct 2024 06:44:19 GMT</pubDate>
    <dc:creator>rjobaan</dc:creator>
    <dc:date>2024-10-08T06:44:19Z</dc:date>
    <item>
      <title>filter does not work when columns are not selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233019#M167412</link>
      <description>&lt;P&gt;I have the following filter created&lt;/P&gt;&lt;P&gt;filter_dates_general =&lt;BR /&gt;VAR result =&lt;BR /&gt;IF(&lt;/P&gt;&lt;P&gt;SELECTEDVALUE(fct_revenue[Start_Date])&amp;gt;= MIN(dim_calendar[Date])&lt;BR /&gt;&amp;amp;&amp;amp;SELECTEDVALUE(fct_revenue[Start_Date])&amp;lt;=MAX(dim_calendar[Date])&lt;BR /&gt;||&lt;BR /&gt;SELECTEDVALUE(fct_revenue[End_Date])&amp;gt;= MIN(dim_calendar[Date])&lt;BR /&gt;&amp;amp;&amp;amp;SELECTEDVALUE(fct_revenue[End_Date])&amp;lt;=MAX(dim_calendar[Date])&lt;BR /&gt;||&lt;BR /&gt;SELECTEDVALUE(fct_revenue[Start_Date])&amp;lt;= MIN(dim_calendar[Date])&lt;BR /&gt;&amp;amp;&amp;amp;SELECTEDVALUE(fct_revenue[End_Date])&amp;gt;=MAX(dim_calendar[Date]),&lt;/P&gt;&lt;P&gt;1,&lt;BR /&gt;0)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;RETURN result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and a between slicer based on date.&lt;/P&gt;&lt;P&gt;i removed the relationship between fct_revenue and dim_calendar for this&lt;/P&gt;&lt;P&gt;when i have a table with region, absence_code, start_date, end_date, and above filter =1&lt;/P&gt;&lt;P&gt;this filter works fine and is showing all regions which fullfil above formula. so within the date range. or even when start and end date are the same its working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if i create a piechart based on only absence_code its not working anymore because start and end _date are not within the context anymore..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what to do are to adjust that above filter is working for every dimension within dashboard?&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;</description>
      <pubDate>Tue, 08 Oct 2024 06:44:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233019#M167412</guid>
      <dc:creator>rjobaan</dc:creator>
      <dc:date>2024-10-08T06:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: filter does not work when columns are not selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233023#M167413</link>
      <description>&lt;P&gt;When you use a pie chart with just the absence_code, the Start_Date and End_Date fields lose context because they are not included in the visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adjusted Measure:&lt;/P&gt;&lt;PRE&gt;filter_dates_general =&lt;BR /&gt;VAR minDate = MIN(dim_calendar[Date])&lt;BR /&gt;VAR maxDate = MAX(dim_calendar[Date])&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;IF (&lt;BR /&gt;MAX(fct_revenue[Start_Date]) &amp;gt;= minDate &amp;amp;&amp;amp;&lt;BR /&gt;MAX(fct_revenue[Start_Date]) &amp;lt;= maxDate ||&lt;BR /&gt;MAX(fct_revenue[End_Date]) &amp;gt;= minDate &amp;amp;&amp;amp;&lt;BR /&gt;MAX(fct_revenue[End_Date]) &amp;lt;= maxDate ||&lt;BR /&gt;MAX(fct_revenue[Start_Date]) &amp;lt;= minDate &amp;amp;&amp;amp;&lt;BR /&gt;MAX(fct_revenue[End_Date]) &amp;gt;= maxDate,&lt;BR /&gt;1,&lt;BR /&gt;0&lt;BR /&gt;),&lt;BR /&gt;ALLSELECTED(fct_revenue)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;You can use this adjusted measure in a visual filter to filter the pie chart, ensuring that it respects the date range and the absence code context.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 06:52:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233023#M167413</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-10-08T06:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: filter does not work when columns are not selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233058#M167415</link>
      <description>&lt;P&gt;but now it doesnt taken into account the values of the slicer right?&lt;/P&gt;&lt;P&gt;when i used above filter on the pie-chart&amp;nbsp; with filter=1 its showing nothing&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 07:15:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4233058#M167415</guid>
      <dc:creator>rjobaan</dc:creator>
      <dc:date>2024-10-08T07:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: filter does not work when columns are not selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4234960#M167483</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Thanks for the reply from Kedar_Pande&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="189494" data-lia-user-login="rjobaan" class="lia-mention lia-mention-user"&gt;rjobaan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Based on my testing, I recommend modifying your measure as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;filter_dates_general = 
VAR MinDate = MIN(dim_calendar[Date])
VAR MaxDate = MAX(dim_calendar[Date])
VAR result =
    IF(
        (MAX(fct_revenue[Start_Date]) &amp;gt;= MinDate &amp;amp;&amp;amp; MAX(fct_revenue[Start_Date]) &amp;lt;= MaxDate) ||
        (MAX(fct_revenue[End_Date]) &amp;gt;= MinDate &amp;amp;&amp;amp; MAX(fct_revenue[End_Date]) &amp;lt;= MaxDate) ||
        (MAX(fct_revenue[Start_Date]) &amp;lt;= MinDate &amp;amp;&amp;amp; MAX(fct_revenue[End_Date]) &amp;gt;= MaxDate),
        1,
        0
    )
RETURN result&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Although in DAX, the &amp;amp;&amp;amp; (AND) operator has a higher precedence than the || (OR) operator, it is advisable to ensure each logical condition is correctly enclosed in parentheses for accuracy and readability. This helps avoid any issues with logical operation precedence.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Here is my test example:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Test results are as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Before using the measure as a&amp;nbsp;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;ilters&lt;/SPAN&gt;:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;After using the measure as a&amp;nbsp;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;ilters:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Currently, no issues have appeared in my test results.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;For questions about uploading data, you can try the following links:&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;&lt;SPAN&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-upload-PBI-in-Community/m-p/1672886" target="_blank"&gt;&lt;SPAN&gt;Solved: How to upload PBI in Community - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider Accept it &lt;STRONG&gt;as the solution &lt;/STRONG&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 09:04:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4234960#M167483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T09:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: filter does not work when columns are not selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4240670#M167877</link>
      <description>&lt;P&gt;that is not working. finally i find the correct code:&lt;/P&gt;&lt;P&gt;filter_dates_general =&lt;BR /&gt;VAR SelectedStartDate = MIN(dim_calendar[Date])&lt;BR /&gt;VAR SelectedEndDate = MAX(dim_calendar[Date])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT(fct_revenu[DIM_Customer_ID]),&lt;BR /&gt;KEEPFILTERS(&lt;BR /&gt;(fct_revenu[Start_Date] &amp;gt;= SelectedStartDate &amp;amp;&amp;amp; fct_revenu[Start_Date] &amp;lt;= SelectedEndDate) ||&lt;BR /&gt;(fct_revenu[End_Date] &amp;gt;= SelectedStartDate &amp;amp;&amp;amp; fct_revenu[End_Date] &amp;lt;= SelectedEndDate) ||&lt;BR /&gt;(fct_revenu[Start_Date] &amp;lt;= SelectedStartDate &amp;amp;&amp;amp; fct_revenu[End_Date] &amp;gt;= SelectedEndDate)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 06:08:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/filter-does-not-work-when-columns-are-not-selected/m-p/4240670#M167877</guid>
      <dc:creator>rjobaan</dc:creator>
      <dc:date>2024-10-14T06:08:42Z</dc:date>
    </item>
  </channel>
</rss>

