<?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: Filtering logic Issue in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-logic-Issue/m-p/3395972#M128097</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="606451" data-lia-user-login="Aazamk" class="lia-mention lia-mention-user"&gt;Aazamk&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, you want to filter transaction date based on date slicer, right? Here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1)Create a date table with date field as slicer.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date = CALENDAR(DATE(2022,1,1),DATE(2023,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;(2)Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag = IF(MAX('Lookup Table'[transaction_date]) &amp;lt;= LASTDATE('Date'[Date]) &amp;amp;&amp;amp; MAX('Lookup Table'[transaction_date]) &amp;gt;= FIRSTDATE('Date'[Date]),1,0)&lt;/LI-CODE&gt;
&lt;P&gt;(3)Place [Flag]=1 on the visual object filter.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2023 02:02:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-24T02:02:51Z</dc:date>
    <item>
      <title>Filtering logic Issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-logic-Issue/m-p/3392297#M127908</link>
      <description>&lt;P&gt;I have multiple transactions on the same date but each date has a different item cost, In my report, I want the latest item cost which can be differentiated by modified_date in my table. So I am not good in DAXs, I am trying to figure out how to filter the transaction date. I tried but it was not showing values on my selected date range. Below is my DAX and Script.&lt;BR /&gt;&lt;BR /&gt;in this, you can see I have modified_date with hours and minutes from which I want to filter out&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&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;CREATE OR REPLACE VIEW lookup_table
AS
		SELECT a.transaction_id,b.transaction_detail_id,c.sku_id,d.item_id,e.category_id,f.location_id,a.modified_date,
		a.transaction_date,(b.item_cost) AS "Item Cost",
		SUM(b.quantity) AS 'Item On Hand',
		SUM(b.quantity)*SUM(b.item_cost) AS 'Total Cost',
		SUM((b.quantity) * (b.item_cost)) AS 'Extended Cost',
		SUM((b.quantity)* (d.worth)) AS 'Extended Worth',
		SUM(CASE WHEN a.ref_type = 1 THEN b.quantity ELSE 0 END) AS 'Item Sold',
		ABS(CASE WHEN a.ref_type = 1 THEN b.quantity ELSE 0 END) AS 'Item Sold(ABS)',
		SUM(CASE WHEN a.ref_type &amp;lt;&amp;gt; 1 THEN b.quantity ELSE 0 END) AS 'Remaining Item',
		(b.item_cost*SUM(CASE WHEN a.ref_type &amp;lt;&amp;gt; 1 THEN b.quantity ELSE 0 END)) AS 'Remaining Item Cost'
		FROM inv_transactions a
		JOIN inv_transaction_details b ON a.transaction_id = b.transaction_id
		JOIN inv_skus c ON c.sku_id = b.sku_id
		JOIN inv_items d ON d.item_id = c.item_id
		JOIN inv_categories e ON e.category_id = d.category_id
		JOIN inv_locations f ON f.location_id = a.location_id
		#WHERE d.item_code = "P14"
		#and d.item_id =1430
		#where a.transaction_id = 70
		#and year(a.transaction_date) = 2022
		#and f.location_id = 4
		GROUP BY a.transaction_id,b.transaction_detail_id,c.sku_id,d.item_id,e.category_id,f.location_id,
		a.transaction_date,a.modified_date&lt;/LI-CODE&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;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;item cost for max date = 

SUMX (
    SUMMARIZE (
        'Lookup Table',
        'INV Sku'[sku],
        'INV Categories'[name],
        'INV Items'[item_code],
        'INV Locations'[location_name]
        
    ),
    VAR MaxDate =
        CALCULATE (
            MAXX('Lookup Table', 'Lookup Table'[transaction_date]),
            ALL ( 'Lookup Table'[transaction_date] )
           
        )
    
    RETURN
        CALCULATE (
            MAX( 'Lookup Table'[Item Cost] ),
            KEEPFILTERS ( 'Lookup Table'[transaction_date] = MaxDate)
        )
)&lt;/LI-CODE&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, 22 Aug 2023 11:02:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-logic-Issue/m-p/3392297#M127908</guid>
      <dc:creator>Aazamk</dc:creator>
      <dc:date>2023-08-22T11:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering logic Issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-logic-Issue/m-p/3395972#M128097</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="606451" data-lia-user-login="Aazamk" class="lia-mention lia-mention-user"&gt;Aazamk&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, you want to filter transaction date based on date slicer, right? Here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1)Create a date table with date field as slicer.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date = CALENDAR(DATE(2022,1,1),DATE(2023,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;(2)Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag = IF(MAX('Lookup Table'[transaction_date]) &amp;lt;= LASTDATE('Date'[Date]) &amp;amp;&amp;amp; MAX('Lookup Table'[transaction_date]) &amp;gt;= FIRSTDATE('Date'[Date]),1,0)&lt;/LI-CODE&gt;
&lt;P&gt;(3)Place [Flag]=1 on the visual object filter.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 02:02:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-logic-Issue/m-p/3395972#M128097</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-24T02:02:51Z</dc:date>
    </item>
  </channel>
</rss>

