Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8734

Incorrect results for days between two days excl & inclwkend

$
0
0

Hi,

 

We have 3 Data providers DP1, DP2,DP3 with measures along with Equip_Id.

I have to show

 

In DP1, we have Equip_Id, Eff_st_Dt, Eff_End_Dt

 

We have to calculate the Equip used for 4 Quarters. First Quarter from Jan to Mar

 

We have to calculate the no of days between Qtr3_Calc_St_Dt and Qtr3_Calc_End_Dt including and excluding weekends.

if Equip_Id is utilized on the same day i.e. Qtr3_Calc_St_Dt and Qtr3_Calc_End_Dt then no of days=1 where are days_between function returns 0

 

The below results are for Excluding weekends are correct for Eqps 63,33

 

when I drag

Equip_id,Eff_St_Dt,Eff_End_Dt,Qtr3_St_Dt,Qtr3_End_Dt  Qtr3_Calc_St_Dt, Qtr3_Calc_End_Dt,Q3_Used

          63  6/6/2014       12/31/99  7/1/2014    9/30/2014       7/1/2014                    9/30/2014           66

          33       8/4/2014     12/31/99  7/1/2014    9/30/2014    8/4/2014                  9/30/2014           42

          232    5/12/2014    5/15/2014                                                                                                   1

          232    5/16/2014    5/19/2014                                                           1

           232  7/2/2014       12/31/99  7/1/2014     9/30/2014       7/2/2014                      9/30/2014       65

           675  6/1/2014  6/5/2014                                                                                                           1                                       

           675  6/6/2014  6/28/2014                                                                                                         1

            675  6/7/2014  6/10/2014                                                                                                         1

 

When I drag Equip_Id and Q3_Eqp_Utilized, I am getting incorrect results

Equip_id,Eqp_Utilized

63        66

33        42

232       66

675       1

 

Report Output

 

Equip_Id,DP1_measure1, DP2measure,DP3 measure, Q1_Eqp_Utilized, Q2_Eqp_Utilized,Q3_Utilized,Q4_Utilized

 

Calculation of  Q3_Eqp_Utilized

=  (If([Prompt for Weekends]="N"   )  Then Sum((Truncate(DaysBetween([Qtr3_Calc_St_Dt]; [Qtr3_Calc_End_Dt]) / 7 ; 0) * 5)+ ToNumber(Substr

 

 

("123455512344451233345122234511123450012340123455"; ((DayNumberOfWeek([Qtr3_Calc_St_Dt])-1)*7)+Mod(DaysBetween([Qtr3_Calc_St_Dt];

 

 

[Qtr3_Calc_End_Dt]);7)+1 ; 1))  ForEach([Equip_id];[Qtr3_Calc_St_Dt];[Qtr3_Calc_End_Dt]))  Else Sum((DaysBetween

 

 

([Qtr3_Calc_St_Dt];RelativeDate([Qtr3_Calc_End_Dt];1) )  ForEach([Equip_id];[Qtr3_Calc_St_Dt];[Qtr3_Calc_End_Dt])  ) ))


Viewing all articles
Browse latest Browse all 8734

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>