9 Replies Latest reply: Jun 21, 2016 1:43 AM by Supriya R RSS

    Getting wrong counts in setAnalysis

    Supriya R

      Hi all,

       

      I am trying to get counts where final_test_status={'passed'} and campaign_id are from batch 23 and 24 and its current_start_date = {"$(=Date(WeekStart(today()) + 1, 'MM-DD-YYYY'))"}>}.

       

      I got required campaign_id from:

       

      Concat(DISTINCT {<campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(today()) + 1, 'MM-DD-YYYY'))"}>})

      >} campaign_id, ', ') = 350,351,352,353

       

      Putting this expresssion inside set analysis to get counts gives wrong count:

       

      Count({$<final_test_status={'passed'}, campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(Today()) + 1, 'MM-DD-YYYY'))"}>})>} course_completed)

       

      To debug hardcoding campaign_id values in setAnalysis gives correct count :

       

      Count({$< final_test_status={'passed'},campaign_id ={'350','351','352','353'}>} course_completed)


      Why values are getting differed.Please help me on this regard.



      Thanks.

      Supriya

        • Re: Getting wrong counts in setAnalysis
          Kamal Kumar Sanguri

          Please check if you have any filter applied and also check the alternate state of the object where you have this expression.

           

          -Kamal

          • Re: Getting wrong counts in setAnalysis
            Sunny Talwar

            How about doing it this way:

             

            Count({$<final_test_status={'passed'}, campaignid = {$(=Concat(DISTINCT {<campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(today()) + 1, 'MM-DD-YYYY'))"}>})>} campaign_id, ', ')}>} course_completed)

            • Re: Getting wrong counts in setAnalysis
              Stefan Wühl

              Where do you test for 'passed' status here:

               

              Concat(DISTINCT {<campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(today()) + 1, 'MM-DD-YYYY'))"}>})

              >} campaign_id, ', ') = 350,351,352,353

               

              ?

               

              If above returns the correct numbers, wouldn't then

               

              =Count(DISTINCT {<campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(today()) + 1, 'MM-DD-YYYY'))"}>})

              >} campaign_id)

               

              return the required 4?

                • Re: Getting wrong counts in setAnalysis
                  Stefan Wühl

                  Also note that you used campaignid instead of campaign_id here:

                   

                  Count({$<final_test_status={'passed'}, campaignid = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(Today()) + 1, 'MM-DD-YYYY'))"}>})>} course_completed)

                    • Re: Getting wrong counts in setAnalysis
                      Supriya R

                      HI swuehl,

                       

                      Thanks for reply

                       

                      campaignid is a typo error,it is campaign_id.

                       

                      Here i want count of datas where its final_test_status={'passed'} and for only those campaign_id. Not the count of campaign_id.

                        • Re: Getting wrong counts in setAnalysis
                          Stefan Wühl

                          campaignid is a typo error,it is campaign_id.

                           

                          Here i want count of datas where its final_test_status={'passed'} and for only those campaign_id. Not the count of campaign_id.

                          Ok, I just wonder if you are not comparing different things looking at your two different expressions, hence you can't compare the results.

                           

                          If you want to get help to get your correct count, I think we would need to know more about your data model and data.

                           

                          It would would be best if you could upload a small sample QVW

                            • Re: Getting wrong counts in setAnalysis
                              Supriya R

                              Hi  swuehl ,

                               

                              Please look into attached qvf file, i need to get counts by putting condition on front end instead of scripting condition in loader.

                               

                              LOAD `campaign_id` as  campaignid,

                              `batch_meta_data_id`, 

                                  date(floor(start_date),'MM-DD-YYYY') as current_start_date,

                                  `expiration_date`;

                              SQL SELECT

                              `batch_meta_data_id`,

                              `campaign_id`,

                              `start_date`,

                              `expiration_date`

                              FROM CAMPAIGN;

                               

                              CurrentCampaignData:

                              Load

                              batch_meta_data_id,

                              campaignid as current_campaign_id

                              Resident CAMPAIGN

                              WHERE ( current_start_date = Date(weekstart (Num ( today() ),-1 ) +1)) and match(batch_meta_data_id ,'23','24');

                               

                               

                              As if now when i have scripted condition in loader  as above and put


                              count({$<DateType= {'completion'},final_test_status={'passed'},campaign_id = P(current_campaign_id)>} course_completed)

                               

                              in front end i am getting correct count ,But  When instead of scripting in loader i put whole condition in front end i am not getting proper count value.

                               

                               

                              Please help me on this.