<?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: DAX for Submission KPI in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201614#M116409</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="548308" data-lia-user-login="koyDominic" class="lia-mention lia-mention-user"&gt;koyDominic&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Oh! my mistake&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Invoice Submission KPI =
VAR Submitted = 'Table'[Invoice Submitted]
VAR TimeOut = 'Table'[Delivery - Time Out]
VAR MaxDate = TimeOut + 4
VAR Dates =
    CALENDAR ( TimeOut, MaxDate )
VAR MaxDate1 =
    MAXX ( FILTER ( Dates, WEEKDAY ( [Date], 2 ) = 5 ), [Date] )
VAR MaxDate2 =
    MAXX ( FILTER ( Dates, WEEKDAY ( [Date], 2 ) = 2 ), [Date] )
RETURN
    SWITCH (
        TRUE (),
        WEEKDAY ( TimeOut, 2 )
            IN { 1, 2, 3, 4 }
            &amp;amp;&amp;amp; Submitted &amp;lt;= MaxDate1, "Compliant",
        WEEKDAY ( TimeOut, 2 )
            IN { 5, 6, 7 }
            &amp;amp;&amp;amp; Submitted &amp;lt;= MaxDate2, "Compliant",
        "None compliant"
    )&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 23 Apr 2023 19:31:44 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-04-23T19:31:44Z</dc:date>
    <item>
      <title>DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201092#M116378</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help fo a DAX for invoice submission KPI. I will create a new column to know if I achieved my KPI for invoice submission.&lt;/P&gt;&lt;P&gt;My baseline is the delivery timeout column, my KPIs are:&lt;/P&gt;&lt;P&gt;1. for deliveries done on Monday to Wednesday - the invoice must be submitted on or before Friday (same week)&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. for deliveries done on Thursday to Sunday - the invoice must be submitted on or before Tuesday (next week)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Requesting help for correct DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2023 18:18:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201092#M116378</guid>
      <dc:creator>koyDominic</dc:creator>
      <dc:date>2023-04-22T18:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201497#M116398</link>
      <description>&lt;P&gt;Hi Errol,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like you would benefit from learning about &lt;A href="https://dax.guide/weekday/" target="_self"&gt;the WEEKDAY function&lt;/A&gt;&amp;nbsp;and/or &lt;A href="https://dax.guide/switch/" target="_self"&gt;the SWITCH function&lt;/A&gt;. Hope that helps. Happy to help if you get stuck along the way.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;----------------------------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 13:44:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201497#M116398</guid>
      <dc:creator>Wilson_</dc:creator>
      <dc:date>2023-04-23T13:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201531#M116399</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="28848" data-lia-user-login="Wilson" class="lia-mention lia-mention-user"&gt;Wilson&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply. I have tried the Weekday function yesterday but I cannot get the result.&lt;/P&gt;&lt;P&gt;I will try the switch function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 15:19:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201531#M116399</guid>
      <dc:creator>koyDominic</dc:creator>
      <dc:date>2023-04-23T15:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201549#M116400</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="548308" data-lia-user-login="koyDominic" class="lia-mention lia-mention-user"&gt;koyDominic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;Invoice Submission KPI =&lt;BR /&gt;VAR TimeOut = 'Table'[Delivery - Time Out]&lt;BR /&gt;VAR MaxDate = TimeOut + 4&lt;BR /&gt;VAR Dates =&lt;BR /&gt;CALENDAR ( TimeOut, MaxDate )&lt;BR /&gt;VAR MaxDate1 =&lt;BR /&gt;MAXX ( FILTER ( Dates, WEEKDAY ( [Date], 2 ) = 5 ), [Date] )&lt;BR /&gt;VAR MaxDate2 =&lt;BR /&gt;MAXX ( FILTER ( Dates, WEEKDAY ( [Date], 2 ) = 2 ), [Date] )&lt;BR /&gt;RETURN&lt;BR /&gt;SWITCH (&lt;BR /&gt;TRUE (),&lt;BR /&gt;WEEKDAY ( TimeOut, 2 )&lt;BR /&gt;IN { 1, 2, 3, 4 }&lt;BR /&gt;&amp;amp;&amp;amp; TimeOut &amp;lt;= MaxDate1, "Compliant",&lt;BR /&gt;WEEKDAY ( TimeOut, 2 )&lt;BR /&gt;IN { 5, 6, 7 }&lt;BR /&gt;&amp;amp;&amp;amp; TimeOut &amp;lt;= MaxDate2, "Compliant",&lt;BR /&gt;"None compliant"&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 16:44:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201549#M116400</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-04-23T16:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201589#M116403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/317289" target="_self"&gt;&lt;SPAN class=""&gt;tamerj1&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and I appreciated your help. I tried the above, however all results shows "compliant". I guess the BI calculated based only on the weekdays but did not consider dates. I attached reference picture of the result below. The marked in red are supposed to be non compliant since it failed to submit the invoices before Tuesday (March 28) of the following week. The marked in yellow are correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 18:10:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201589#M116403</guid>
      <dc:creator>koyDominic</dc:creator>
      <dc:date>2023-04-23T18:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201601#M116407</link>
      <description>&lt;P&gt;Hello Errol,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I was hoping you would be more specific on where you were actually getting stuck, for learning's sake. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In any case, this was my DAX for your calculated column:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Submission KPI = 
VAR DayOfTheWeek = WEEKDAY ( Table1[Delivery Time Out], 2 )
VAR InvoiceDeadline =
SWITCH (
    TRUE(),
    DayOfTheWeek &amp;lt;= 3, Table1[Delivery Time Out] - DayOfTheWeek + 5, -- Time Out - DayoftheWeek will always return the prior Sunday; +5 gets to Friday
    Table1[Delivery Time Out] - DayOfTheWeek + 9 -- Time Out - DayoftheWeek will always return the prior Sunday; +9 gets to the following Tuesday
)

RETURN
Table1[Invoice Submitted] &amp;lt;= InvoiceDeadline&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Created my own mini dataset for testing and this is what I get in my table:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;----------------------------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 18:53:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201601#M116407</guid>
      <dc:creator>Wilson_</dc:creator>
      <dc:date>2023-04-23T18:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201614#M116409</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="548308" data-lia-user-login="koyDominic" class="lia-mention lia-mention-user"&gt;koyDominic&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Oh! my mistake&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Invoice Submission KPI =
VAR Submitted = 'Table'[Invoice Submitted]
VAR TimeOut = 'Table'[Delivery - Time Out]
VAR MaxDate = TimeOut + 4
VAR Dates =
    CALENDAR ( TimeOut, MaxDate )
VAR MaxDate1 =
    MAXX ( FILTER ( Dates, WEEKDAY ( [Date], 2 ) = 5 ), [Date] )
VAR MaxDate2 =
    MAXX ( FILTER ( Dates, WEEKDAY ( [Date], 2 ) = 2 ), [Date] )
RETURN
    SWITCH (
        TRUE (),
        WEEKDAY ( TimeOut, 2 )
            IN { 1, 2, 3, 4 }
            &amp;amp;&amp;amp; Submitted &amp;lt;= MaxDate1, "Compliant",
        WEEKDAY ( TimeOut, 2 )
            IN { 5, 6, 7 }
            &amp;amp;&amp;amp; Submitted &amp;lt;= MaxDate2, "Compliant",
        "None compliant"
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 23 Apr 2023 19:31:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3201614#M116409</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-04-23T19:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: DAX for Submission KPI</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3202249#M116448</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="548308" data-lia-user-login="koyDominic" class="lia-mention lia-mention-user"&gt;koyDominic&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You can achieve this KPI of 2 points mentioned with following below steps:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1. First Create a column “Same Week Friday” with below DAX expression to calculate Friday of Same Week:&lt;/P&gt;&lt;P&gt;Same Week Friday = 'Delivery Times'[Delivery Timeout].[Date] - WEEKDAY('Delivery Times'[Delivery Timeout].[Date],2) + 5&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;2. Now Create Column “Next Week Tuesday Date” with DAX expression as below which gives us the Next Week Tuesday Date:&lt;/P&gt;&lt;P&gt;Next Week Tuesday = 'Delivery Times'[Delivery Timeout].[Date] - WEEKDAY('Delivery Times'[Delivery Timeout].[Date],2) + 9&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;3. Create a column to calculate KPI based on conditions you mentioned as below DAX expression:&lt;/P&gt;&lt;P&gt;KPI Value = IF(WEEKDAY('Delivery Times'[Delivery Timeout].[Date]) == 2 || WEEKDAY('Delivery Times'[Delivery Timeout].[Date]) == 3 || WEEKDAY('Delivery Times'[Delivery Timeout].[Date]) == 4,&lt;/P&gt;&lt;P&gt;IF('Delivery Times'[Invoice Submitted].[Date] &amp;gt; 'Delivery Times'[Delivery Timeout].[Date] &amp;amp;&amp;amp; 'Delivery Times'[Invoice Submitted].[Date] &amp;lt;= 'Delivery Times'[Same Week Friday].[Date], "Compliant","Non-Compliant"),&lt;/P&gt;&lt;P&gt;IF('Delivery Times'[Invoice Submitted].[Date] &amp;gt; 'Delivery Times'[Delivery Timeout].[Date] &amp;amp;&amp;amp; 'Delivery Times'[Invoice Submitted].[Date] &amp;lt;= 'Delivery Times'[Next Week Tuesday].[Date], "Compliant","Non-Compliant")&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If this answer helps, please mark it as an Accepted Solution so it would help others to find the solution.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Inogic Professional Service Division&lt;/P&gt;&lt;P&gt;An expert technical extension for your techno-functional business needs&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM&lt;/P&gt;&lt;P&gt;Drop an email at &lt;A href="mailto:crm@inogic.com" target="_blank" rel="noopener"&gt;crm@inogic.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Service:&amp;nbsp; &lt;A href="http://www.inogic.com/services/" target="_blank" rel="noopener"&gt;http://www.inogic.com/services/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Power Platform/Dynamics 365 CRM Tips and Tricks:&amp;nbsp; &lt;A href="http://www.inogic.com/blog/" target="_blank" rel="noopener"&gt;http://www.inogic.com/blog/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 07:20:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-for-Submission-KPI/m-p/3202249#M116448</guid>
      <dc:creator>SamInogic</dc:creator>
      <dc:date>2023-04-24T07:20:35Z</dc:date>
    </item>
  </channel>
</rss>

