<?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: Plotting a Distribution Tracking Chart Over a Defined Date Range in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779797#M96111</link>
    <description>&lt;P&gt;You are mixing numbers (datenums) and strings. I would use much more robust methods of handling dates than your get_dates function as you are converting dates to strings. You should keep them as dates.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TOP5:get_dates = Function({},
    today_date = Format(Today(), "yyyy-mm-dd");
    start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
    evallist({start_of_month, today_date});
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I have also provided these more robust methods multiple times in my examples to you).&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2024 07:57:50 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-08-07T07:57:50Z</dc:date>
    <item>
      <title>Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779557#M96074</link>
      <description>&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I hope you're all doing well ! I have a question and would really appreciate your help.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I've been working on a function to create a NOK tracking chart that shows the NOK percentages over a specific date range. Here's a quick rundown of what i want my function to do :&lt;BR /&gt;- I get the start and end dates for the current month.&lt;BR /&gt;- Next i creat new table to store the NOK percentages for each date and&amp;nbsp;It goes through each day from the start of the month to today.&lt;BR /&gt;- Then it inserts the date and the corresponding NOK percentages into the new table.&lt;BR /&gt;- Finally, it creates a line graph showing the NOK percentages over the date range.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I've got the function mostly working, but I'm running into a bit of trouble.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TOP5:get_dates = Function({},
    today_date = Format(Today(), "yyyy-mm-dd");
    start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
    evallist({start_of_month, today_date});
);

TOP5:calculate_nok_percentages = Function({dt},

    {start_of_month, today_date} = TOP5:get_dates();

    dt_top5 = dt &amp;lt;&amp;lt; Summary(
        Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
        Freq("Aucun(e)"),
        Weight("Aucun(e)"),
        invisible
    );

    nameFilesNok = Associative Array(Column(dt_top5, "Nom de fichier") &amp;lt;&amp;lt; Get Values) &amp;lt;&amp;lt; Get Keys;

    total_nb_total_ict = 0;
    total_nb_total_fct = 0;
    total_nb_nok_ict = 0;
    total_nb_nok_fct = 0;

    For(k = 1, k &amp;lt;= N Items(nameFilesNok), k++,
        FileRows = dt_top5 &amp;lt;&amp;lt; get rows where(
            :File Name == nameFilesNok[k] &amp;amp; Num(Char(:Date)) &amp;gt;= Num(start_of_month) &amp;amp; Num(Char(:Date)) &amp;lt;= Num(today_date) &amp;amp; Contains(:File Name, "GOLDEN") == 0
        );

        nb_total_ict = 0;
        nb_total_fct = 0;
        nb_nok_ict = 0;
        nb_nok_fct = 0;

        total_rows = N Items(FileRows);

        For(j = 1, j &amp;lt;= total_rows, j++,
            If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
                nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
                );
            , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
                nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
                );
            )
        );

        total_nb_total_ict += nb_total_ict;
        total_nb_total_fct += nb_total_fct;
        total_nb_nok_ict += nb_nok_ict;
        total_nb_nok_fct += nb_nok_fct;
    );

    percent_nok_ict = (total_nb_nok_ict / total_nb_total_ict) * 100;
    percent_nok_fct = (total_nb_nok_fct / total_nb_total_fct) * 100;

    Eval List({percent_nok_ict, percent_nok_fct});
);

TOP5:create_nok_tracking_chart = Function({dt},

    {start_of_month, today_date} = TOP5:get_dates();

    dt_nok = New Table("NOK Percentages",
        Add Rows(0),
        New Column("Date", Character),
        New Column("Percent NOK ICT", Numeric),
        New Column("Percent NOK FCT", Numeric)
    );

    For(i = Num(start_of_month), i &amp;lt;= Num(today_date), i++,
        // Correct date formatting
        today_str = Format(Date(i), "yyyy-mm-dd");
        Eval List({start_of_month, today_date}) = Eval List({today_str, today_str});
        result = TOP5:calculate_nok_percentages(dt);

        Insert Into(dt_nok,
            today_str,
            result[1],
            result[2]
        );
    );

    Graph Builder(
        Size( 700, 500 ),
        Show Control Panel( 0 ),
        Variables( X( :Date ), Y( :Percent NOK ICT ), Y( :Percent NOK FCT ) ),
        Elements(
            Line(
                X,
                Y( 1 ),
                Legend( 6 ),
                Line Color( "Red" )
            ),
            Line(
                X,
                Y( 2 ),
                Legend( 8 ),
                Line Color( "Blue" )
            )
        ),
        Legend Position( "Top" )
    );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;i did get this error message :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*:
Unresolved name: Date JSL when accessing or evaluating "Date JSL". Date JSL( i ) /*###*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yass_0-1722949692680.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66873iE8136A2051AFEDC8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yass_0-1722949692680.png" alt="Yass_0-1722949692680.png" /&gt;&lt;/span&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Could anyone provide some guidance or tips on how to improve this ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Aug 2024 13:11:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779557#M96074</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-06T13:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779568#M96075</link>
      <description>&lt;P&gt;The problem is in the create_nok_tracking_chart function&lt;/P&gt;&lt;P&gt;I made some changes to simplify the For loop, but unfortunately, it's not working:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;current_date = Date(start_of_month);

    While(current_date &amp;lt;= Date(today_date),
        // Correct date formatting
        today_str = Format(current_date, "yyyy-MM-dd");
        
        result = TOP5:calculate_nok_percentages(dt);
        
        Insert Into(dt_nok,
            today_str,
            result[1],
            result[2]
        );
        
        // Increment date by 1 day
        current_date = Date Increment(current_date, "Day", 1);
    );&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 14:54:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779568#M96075</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-06T14:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779620#M96084</link>
      <description>&lt;P&gt;What does Date() function do?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 15:17:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779620#M96084</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-06T15:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779793#M96107</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I used&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Date() to&amp;nbsp;&lt;/SPAN&gt;create a date object from a list of date. In my case i will get all dates from the begining of month to today's and Date() function will ensure that date&amp;nbsp;are in a date format that supports date arithmetic and comparisons.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 07:08:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779793#M96107</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-07T07:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779794#M96108</link>
      <description>&lt;P&gt;To my knowledge there is no Date() function in JMP (there is &amp;lt;&amp;lt; Date() which can be sent to calendar box but it is totally different thing).&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 07:19:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779794#M96108</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-07T07:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779796#M96110</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Okay I understand. In that case can I use:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;current_date = Format(start_of_month, "yyyy-MM-dd");

While ( current_date &amp;lt;= today_date,

    today_str = Format(current_date, "yyyy-MM-dd");
    result = TOP5:calculate_nok_percentages(dt);

    Insert Into (dt_nok,
        today_str
        result[1],
        result[2]
    );

    current_date = Date Increment(current_date, "Day", 1);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2024 07:35:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779796#M96110</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-07T07:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779797#M96111</link>
      <description>&lt;P&gt;You are mixing numbers (datenums) and strings. I would use much more robust methods of handling dates than your get_dates function as you are converting dates to strings. You should keep them as dates.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TOP5:get_dates = Function({},
    today_date = Format(Today(), "yyyy-mm-dd");
    start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
    evallist({start_of_month, today_date});
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I have also provided these more robust methods multiple times in my examples to you).&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 07:57:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779797#M96111</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-07T07:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779799#M96113</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Yes, that’s what I’m trying to do now. I will keep the date format and work on the logic to see if it works.&lt;BR /&gt;&lt;BR /&gt;Thank you and&amp;nbsp;I’m sorry if my questions are repetitive and sometimes seem silly it’s just because I started using JMP and the JSL language two months ago for my internship.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 08:16:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779799#M96113</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-07T08:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779890#M96139</link>
      <description>&lt;P&gt;I'm really confused. I've tried this method :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

TOP5 = New Namespace(
    "TOP5"
);

TOP5:get_dates = Function({},
    today_date = Format(Today(), "yyyy-mm-dd");
    start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
    evallist({start_of_month, today_date});
);

TOP5:calculate_nok_percentages = Function({dt},

    {start_of_month, today_date} = TOP5:get_dates();

    dt_top5 = dt &amp;lt;&amp;lt; Summary(
        Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
        Freq("Aucun(e)"),
        Weight("Aucun(e)"),
        invisible
    );

    nameFilesNok = Associative Array(Column(dt_top5, "Nom de fichier") &amp;lt;&amp;lt; Get Values) &amp;lt;&amp;lt; Get Keys;

    total_nb_total_ict = 0;
    total_nb_total_fct = 0;
    total_nb_nok_ict = 0;
    total_nb_nok_fct = 0;

    For(k = 1, k &amp;lt;= N Items(nameFilesNok), k++,
        FileRows = dt_top5 &amp;lt;&amp;lt; get rows where(
            :File Name == nameFilesNok[k] &amp;amp; Num(Char(:Date)) &amp;gt;= Num(start_of_month) &amp;amp; Num(Char(:Date)) &amp;lt;= Num(today_date) &amp;amp; Contains(:File Name, "GOLDEN") == 0
        );

        nb_total_ict = 0;
        nb_total_fct = 0;
        nb_nok_ict = 0;
        nb_nok_fct = 0;

        total_rows = N Items(FileRows);

        For(j = 1, j &amp;lt;= total_rows, j++,
            If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
                nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
                );
            , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
                nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
                );
            )
        );

        total_nb_total_ict += nb_total_ict;
        total_nb_total_fct += nb_total_fct;
        total_nb_nok_ict += nb_nok_ict;
        total_nb_nok_fct += nb_nok_fct;
    );

    percent_nok_ict = (total_nb_nok_ict / total_nb_total_ict) * 100;
    percent_nok_fct = (total_nb_nok_fct / total_nb_total_fct) * 100;

    Eval List({percent_nok_ict, percent_nok_fct});
);

TOP5:calculate_nok_percentages_over_time = Function({dt},

    {start_of_month, today_date} = TOP5:get_dates();

    dt_results = New Table("NOK Percentages Over Time",
        New Column("Date", Numeric),
        New Column("Percent_NOK_ICT", Numeric),
        New Column("Percent_NOK_FCT", Numeric)
    );

    // Set the format for the Date column
    Column(dt_results, "Date") &amp;lt;&amp;lt; Data Type(
        Numeric,
        Format( "Format Pattern", "&amp;lt;YYYY&amp;gt;-&amp;lt;MM&amp;gt;-&amp;lt;DD&amp;gt;", 10 ),
        Input Format( "Format Pattern", "&amp;lt;YYYY&amp;gt;-&amp;lt;MM&amp;gt;-&amp;lt;DD&amp;gt;" ),
        Format( "Date Abbrev", 20 )
    ) &amp;lt;&amp;lt; Set Field Width(10);

    date = today_date;

    While(Num(Char(date)) &amp;gt;= Num(start_of_month),
        {percent_nok_ict, percent_nok_fct} = TOP5:calculate_nok_percentages_for_date(dt, date);

        dt_results &amp;lt;&amp;lt; Add Rows(
           {Format(date, "yyyy-mm-dd"), percent_nok_ict, percent_nok_fct}
        );

        date = Date Increment(date, "day", -1);
    );

    dt_results;
);

TOP5:calculate_nok_percentages_for_date = Function({dt, specific_date},

    {start_of_month, today_date} = TOP5:get_dates();

    dt_top5 = dt &amp;lt;&amp;lt; Summary(
        Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
        Freq("Aucun(e)"),
        Weight("Aucun(e)"),
        invisible
    );

    nameFilesNok = Associative Array(Column(dt_top5, "Nom de fichier") &amp;lt;&amp;lt; Get Values) &amp;lt;&amp;lt; Get Keys;

    total_nb_total_ict = 0;
    total_nb_total_fct = 0;
    total_nb_nok_ict = 0;
    total_nb_nok_fct = 0;

    For(k = 1, k &amp;lt;= N Items(nameFilesNok), k++,
        FileRows = dt_top5 &amp;lt;&amp;lt; get rows where(
            :File Name == nameFilesNok[k] &amp;amp; Num(Char(:Date)) &amp;gt;= Num(start_of_month) &amp;amp; Num(Char(:Date)) &amp;lt;= Num(specific_date) &amp;amp; Contains(:File Name, "GOLDEN") == 0
        );

        nb_total_ict = 0;
        nb_total_fct = 0;
        nb_nok_ict = 0;
        nb_nok_fct = 0;

        total_rows = N Items(FileRows);

        For(j = 1, j &amp;lt;= total_rows, j++,
            If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
                nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
                );
            , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
                nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
                );
            )
        );

        total_nb_total_ict += nb_total_ict;
        total_nb_total_fct += nb_total_fct;
        total_nb_nok_ict += nb_nok_ict;
        total_nb_nok_fct += nb_nok_fct;
    );

    percent_nok_ict = (total_nb_nok_ict / total_nb_total_ict) * 100;
    percent_nok_fct = (total_nb_nok_fct / total_nb_total_fct) * 100;

    Eval List({percent_nok_ict, percent_nok_fct});
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;and when i can my fonction in :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TOP5:Do = Function ({nb_date1, nb_date2},
	//Ouverture de la table de données
	dt = Open( "/D:/Project JMP/Tables/TableData PY.jmp", invisible );

	// Calculate NOK percentages
	{percent_nok_ict, percent_nok_fct} = TOP5:calculate_nok_percentages(dt);

	// Call the new function to get NOK percentages over time
	dt_results = TOP5:calculate_nok_percentages_over_time(dt);

	// Display the results table
	dt_results &amp;lt;&amp;lt; Show Window;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I keep getting an error every time.&lt;BR /&gt;&lt;BR /&gt;What I want to do is create a function that calculates the NOK percentages like the second function TOP5:calculate_nok_percentages_over_time . The difference is that this function will calculate the NOK percentage between today's date and the start of the month, then from yesterday to the start of the month, and so on, until it reaches the start of the month. The results should be stored in a new table so I can use them to create graphs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 14:54:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779890#M96139</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-07T14:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779895#M96141</link>
      <description>&lt;P&gt;What is the error you are getting?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 15:09:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779895#M96141</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-07T15:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779975#M96157</link>
      <description>&lt;P&gt;/*:&lt;BR /&gt;The argument must be numeric at line 1 when accessing or evaluating 'Format', Format/*###*/(date, "yyyy-mm-dd").&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 18:34:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779975#M96157</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-07T18:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779979#M96159</link>
      <description>&lt;P&gt;You are most likely getting that error as your date variable is a string and &lt;A href="https://help.jmp.com/help?keyword=JSL%20Format&amp;amp;lang=en&amp;amp;os=win&amp;amp;source=application&amp;amp;version=18.0.1" target="_blank" rel="noopener"&gt;Format()&lt;/A&gt;&amp;nbsp;requires you to have a numeric variable. My guess that error is from this&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1723056448063.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66934i670DD552D02013A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1723056448063.png" alt="jthi_1-1723056448063.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;date is same as today_date, today_date comes from TOP5:get_dates() which returns strings. Keep the dates as numeric values and you will avoid all of these issues (there is no need to use Num(Char()) conversions, especially when you are starting from Today() which is a numeric value).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you read Date-Time parts from Scripting Guide, starting from this &lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/datetime-functions-and-formats.shtml#" target="_blank"&gt;https://www.jmp.com/support/help/en/18.0/#page/jmp/datetime-functions-and-formats.shtml#&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 18:49:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/779979#M96159</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-07T18:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780198#M96193</link>
      <description>&lt;P&gt;I took your suggestions into account and tried this method. However, I'm still facing an issue: my function returns a table with points in rows.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Yass_0-1723104478767.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66960i15A1E41422722302/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Yass_0-1723104478767.png" alt="Yass_0-1723104478767.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;and I kept &lt;/SPAN&gt;&lt;CODE class=""&gt;date = today_date;&lt;/CODE&gt;&lt;SPAN&gt; because when I run the script with &lt;/SPAN&gt;&lt;CODE class=""&gt;today_date&lt;/CODE&gt;&lt;SPAN&gt; as a parameter directly,&lt;/SPAN&gt;&lt;SPAN&gt; JMP doesn't respond.&lt;/SPAN&gt;&lt;SPAN&gt; I don't understand why assigning &lt;/SPAN&gt;&lt;CODE class=""&gt;date = today_date&lt;/CODE&gt;&lt;SPAN&gt; handles the run more efficiently.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TOP5:get_dates_percent = Function({},
    today_date = Today();
    start_of_month = Date Increment(Today(), "Month", 0, "Start");
    evallist({start_of_month, today_date});
);

TOP5:calculate_nok_percentages_over_time = Function({dt},

    {start_of_month, today_date} = TOP5:get_dates_percent();

    dt_results = New Table("NOK Percentages Over Time",
        New Column("Date", Numeric),
        New Column("Percent_NOK_ICT", Numeric),
        New Column("Percent_NOK_FCT", Numeric)
    );

    // Set the format for the Date column
    Column(dt_results, "Date") &amp;lt;&amp;lt; Data Type(
        Numeric,
        Format("Format Pattern", "&amp;lt;YYYY&amp;gt;-&amp;lt;MM&amp;gt;-&amp;lt;DD&amp;gt;", 10),
        Input Format("Format Pattern", "&amp;lt;YYYY&amp;gt;-&amp;lt;MM&amp;gt;-&amp;lt;DD&amp;gt;"),
        Format("Date Abbrev", 20)
    ) &amp;lt;&amp;lt; Set Field Width(10);

    date = today_date;

    While(date &amp;gt;= start_of_month,
        {percent_nok_ict, percent_nok_fct} = TOP5:calculate_nok_percentages_for_date(dt, date);

        dt_results &amp;lt;&amp;lt; Add Rows(
            {Format(date, "yyyy-mm-dd"), percent_nok_ict, percent_nok_fct}
        );

        date = Date Increment(date, "day", -1);
    );

    dt_results;
);

TOP5:calculate_nok_percentages_for_date = Function({dt, specific_date},

    {start_of_month, today_date} = TOP5:get_dates_percent();

    dt_top5 = dt &amp;lt;&amp;lt; Summary(
        Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
        Freq("Aucun(e)"),
        Weight("Aucun(e)"),
        invisible
    );

    nameFilesNok = Associative Array(Column(dt_top5, "Nom de fichier") &amp;lt;&amp;lt; Get Values) &amp;lt;&amp;lt; Get Keys;

    total_nb_total_ict = 0;
    total_nb_total_fct = 0;
    total_nb_nok_ict = 0;
    total_nb_nok_fct = 0;

    For(k = 1, k &amp;lt;= N Items(nameFilesNok), k++,
        FileRows = dt_top5 &amp;lt;&amp;lt; get rows where(
            :File Name == nameFilesNok[k] &amp;amp; :Date &amp;gt;= start_of_month &amp;amp; :Date &amp;lt;= specific_date &amp;amp; Contains(:File Name, "GOLDEN") == 0
        );

        nb_total_ict = 0;
        nb_total_fct = 0;
        nb_nok_ict = 0;
        nb_nok_fct = 0;

        total_rows = N Items(FileRows);

        For(j = 1, j &amp;lt;= total_rows, j++,
            If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
                nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
                );
            , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
                nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
                );
            )
        );

        total_nb_total_ict += nb_total_ict;
        total_nb_total_fct += nb_total_fct;
        total_nb_nok_ict += nb_nok_ict;
        total_nb_nok_fct += nb_nok_fct;
    );

    percent_nok_ict = (total_nb_nok_ict / total_nb_total_ict) * 100;
    percent_nok_fct = (total_nb_nok_fct / total_nb_total_fct) * 100;

    Eval List({percent_nok_ict, percent_nok_fct});
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 08:08:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780198#M96193</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-08T08:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780200#M96194</link>
      <description>&lt;P&gt;Points in cells mean missing data as you have numeric data type columns.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 08:25:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780200#M96194</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-08T08:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780218#M96200</link>
      <description>&lt;P&gt;I'm uncertain if the problem is about the code's compatibility with my dataset.&lt;BR /&gt;I've attached a sample of my data table for your reference.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 09:30:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780218#M96200</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-08T09:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780234#M96205</link>
      <description>&lt;P&gt;Your dates are numeric value if you mean that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$DOWNLOADS/TableData SVI PY.jmp");

vals = Column(dt, "Date") &amp;lt;&amp;lt; get values;
show(vals);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1723111421843.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66964i01F632828934A3F7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1723111421843.png" alt="jthi_0-1723111421843.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1723111432560.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66965i3403C6F901213959/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1723111432560.png" alt="jthi_1-1723111432560.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 10:04:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780234#M96205</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-08T10:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780237#M96207</link>
      <description>&lt;P&gt;yes my&amp;nbsp;&lt;SPAN&gt;dates are numeric value&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 10:09:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780237#M96207</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-08T10:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780256#M96214</link>
      <description>&lt;P&gt;updates :)&lt;/img&gt;&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;I tried to use the function this way i did put all date on format Numeric. but as always i did get this error i think it's in Date Column:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*:
"Cannot set the value of column 'Percent_NOK_ICT' because the row number (0) is not valid."&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Ouvrir le fichier de données
dt = Open("$DOWNLOADS/TableData SVI PY.jmp", invisible);

// Créer un résumé des données
dt_top5 = dt &amp;lt;&amp;lt; Summary(
    Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
    Freq("Aucun(e)"),
    Weight("Aucun(e)"),
    invisible
);

// Créer la table de résultats
dt_results = New Table("NOK Percentages Over Time",
    New Column("Date", Numeric),
    New Column("Percent_NOK_ICT", Numeric),
    New Column("Percent_NOK_FCT", Numeric)
);

// Obtenir les noms de fichiers NOK
nameFilesNok = Associative Array(Column(dt_top5, "Nom de fichier") &amp;lt;&amp;lt; Get Values) &amp;lt;&amp;lt; Get Keys;

// Boucle sur chaque jour depuis aujourd'hui jusqu'au début du mois
For(i = Today(), i &amp;gt;= Num(Date Increment(Today(), "Month", 0, "Start")), i -= 1,
    current_date = i;
    total_nb_total_ict = 0;
    total_nb_total_fct = 0;
    total_nb_nok_ict = 0;
    total_nb_nok_fct = 0;

    // Calcul des pourcentages NOK pour chaque jour
    For(k = 1, k &amp;lt;= N Items(nameFilesNok), k++,
        FileRows = dt_top5 &amp;lt;&amp;lt; get rows where(
            :Nom de fichier == nameFilesNok[k] &amp;amp; Num(Date(:Date)) &amp;gt;= current_date &amp;amp; Num(Date(:Date)) &amp;lt;= Num(Today()) &amp;amp; Contains(:Nom de fichier, "GOLDEN") == 0
        );

        nb_total_ict = 0;
        nb_total_fct = 0;
        nb_nok_ict = 0;
        nb_nok_fct = 0;

        total_rows = N Items(FileRows);

        For(j = 1, j &amp;lt;= total_rows, j++,
            If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
                nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
                );
            , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
                nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
                If(dt_top5:Result[FileRows[j]] == "NOK",
                    nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
                );
            )
        );

        total_nb_total_ict += nb_total_ict;
        total_nb_total_fct += nb_total_fct;
        total_nb_nok_ict += nb_nok_ict;
        total_nb_nok_fct += nb_nok_fct;
    );

    // Assurez-vous que les totaux ne sont pas zéro avant de calculer les pourcentages
    If(total_nb_total_ict &amp;gt; 0,
        percent_nok_ict = (total_nb_nok_ict / total_nb_total_ict) * 100;
    , 
        percent_nok_ict = 0;
    );

    If(total_nb_total_fct &amp;gt; 0,
        percent_nok_fct = (total_nb_nok_fct / total_nb_total_fct) * 100;
    , 
        percent_nok_fct = 0;
    );

    // Ajouter une nouvelle ligne et définir les valeurs
    dt_results &amp;lt;&amp;lt; Add Rows(1);
    last_row_index = N Rows(dt_results);
    dt_results:Date[last_row_index] = current_date;
    dt_results:Percent_NOK_ICT[last_row_index] = percent_nok_ict;
    dt_results:Percent_NOK_FCT[last_row_index] = percent_nok_fct;
);

// Affichage des résultats
dt_results;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:17:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780256#M96214</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-08T13:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780261#M96217</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1723123948653.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66968i2DABEE2A780B23B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1723123948653.png" alt="jthi_0-1723123948653.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It could be the Date() function which is causing issues (I'm not sure as I don't know how you have defined it).&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:33:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780261#M96217</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-08T13:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting a Distribution Tracking Chart Over a Defined Date Range</title>
      <link>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780970#M96341</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You’ll find attached an updated version&amp;nbsp;of the code that works for anyone interested in this subject !&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Ouvrir le fichier de données
dt = Open( "/D:/Project JMP/Tables/TableDataPY.jmp", invisible );

today_date = Format(Today(), "yyyy-mm-dd");
start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
evallist({start_of_month, today_date});

dt_top5 = dt &amp;lt;&amp;lt; Summary(
    Group(:Date, :Nom de fichier, :Ref Produit, :ProductName, :Baie, :ICT_FCT, :Result, :Reason Error, :CodeError),
    Freq("Aucun(e)"),
    Weight("Aucun(e)"),
    invisible
);

results_table = New Table( "Results",
    New Column( "Date", Character ),
    New Column( "Percent NOK ICT", Numeric ),
    New Column( "Percent NOK FCT", Numeric ),
    New Column( "Total ICT", Numeric ),
    New Column( "NOK ICT", Numeric ),
    New Column( "Total FCT", Numeric ),
    New Column( "NOK FCT", Numeric )
);

For(day = Num(start_of_month), day &amp;lt;= Num(today_date), day = Date Increment(day, "Day", 1),
    current_date = Format(day, "yyyy-mm-dd");

    FileRows = dt_top5 &amp;lt;&amp;lt; get rows where(
        Num(Char(:Date)) == Num(current_date) &amp;amp; Contains(:Nom de fichier, "GOLDEN") == 0
    );

    nb_total_ict = 0;
    nb_total_fct = 0;
    nb_nok_ict = 0;
    nb_nok_fct = 0;

    total_rows = N Items(FileRows);

    For(j = 1, j &amp;lt;= total_rows, j++,
        If(dt_top5:ICT_FCT[FileRows[j]] == "ICT",
            nb_total_ict = nb_total_ict + dt_top5:Nb. de lignes[FileRows[j]];
            If(dt_top5:Result[FileRows[j]] == "NOK",
                nb_nok_ict = nb_nok_ict + dt_top5:Nb. de lignes[FileRows[j]]
            );
        , dt_top5:ICT_FCT[FileRows[j]] == "FCT",
            nb_total_fct = nb_total_fct + dt_top5:Nb. de lignes[FileRows[j]];
            If(dt_top5:Result[FileRows[j]] == "NOK",
                nb_nok_fct = nb_nok_fct + dt_top5:Nb. de lignes[FileRows[j]]
            );
        )
    );

    If(nb_total_ict &amp;gt; 0,
        percent_nok_ict = (nb_nok_ict / nb_total_ict) * 100,
        percent_nok_ict = 0
    );

    If(nb_total_fct &amp;gt; 0,
        percent_nok_fct = (nb_nok_fct / nb_total_fct) * 100,
        percent_nok_fct = 0
    );

    results_table &amp;lt;&amp;lt; Add Rows(1);
    row_index = N Rows(results_table);
    results_table:Date[row_index] = current_date;
    results_table:Percent NOK ICT[row_index] = percent_nok_ict;
    results_table:Percent NOK FCT[row_index] = percent_nok_fct;
    results_table:Total ICT[row_index] = nb_total_ict;
    results_table:NOK ICT[row_index] = nb_nok_ict;
    results_table:Total FCT[row_index] = nb_total_fct;
    results_table:NOK FCT[row_index] = nb_nok_fct;
);

results_table &amp;lt;&amp;lt; Save( "D:/Project JMP/Tables Resultats NOK percentages/Results.jmp" );

// Fermer toutes les tables ouvertes
Close( dt, "No Save" );
Close( dt_top5, "No Save" );

&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 08:27:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Plotting-a-Distribution-Tracking-Chart-Over-a-Defined-Date-Range/m-p/780970#M96341</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-08-12T08:27:07Z</dc:date>
    </item>
  </channel>
</rss>

