Wednesday, 17 February 2016

Finding No Of working days

Challenge:-
Show the number of days between each order’s Order Date and Ship Date, not including the weekends. In other words, show the count of work days between these two dates

Solution:-

1.    Drag Order Number,Order Date,Shipdate to the Rows Shelf.
2.    Right-click drag Order Date and select MDY(Order Date).
3.    Right-click drag Ship Date and select MDY(Ship Date).



4.     Create Calculated Field " Work Days", and put the following into the body of the calculation:




Since we want the total number of days between our Order Date and Ship Date, we will use the date part ‘day’ to get the total days between our dates. The first line of our equation successfully accomplishes this, but that does not account properly for non-work days (weekends). The second part of the equation counts the total weeks between our Order Date and Shipping Date,utilizes the optional anchor date to set the start of the week to Monday. This looks at the Shipping Date compared to the Monday of the week that the order was placed. 
For Example,If our Order Date was Wednesday, Feb 17th, and our Shipping Date was Monday, Feb 22nd, a weekend has occurred; however, a whole week has not completed. But since we are comparing the Shipping Date to the Monday of whatever week the Order Date falls on, we are now comparing Monday, Feb 22nd to Monday, Feb 29th, and the ‘week’ difference is now one. We then account for both weekend days by multiplying the total number of weeks between our dates by 2, and subtract this amount from our total days.

5.     Drag Work Days to the Columns shelf.
6.    Change the Marks Type to Bar and Click on ‘Abc’ in toolbar


Now, we see the correct count of days that our products took to ship:


Thanks Guru's,
Prazval.ks





Finding Student Best Subject

Lets achieve this using LOD's.  For this, We need to create 3 calculations, to find out the best scoring subject of each student ....