I created a payslip for a month without any unpaid leave.
While calculating the payslip it shows every amount as zero for all other salary rules but if there is an unpaid leave(LOP) on that month it can be computed
These are my salary rules for unpaid leave:
Condition :
result=bool(worked_days.LOP)
Calculation :
lop_days=worked_days.LOP and (worked_days.LOP.number_of_days*-1)
result=((categories.BASIC/30)*lop_days)+((categories.DA/30)*lop_days)+((categories.ALW/30)*lop_days)
This is the result after computing the payslip without unpaid leave/LOP
Related
I have a table with daily snapshot data that has a date and amount column. I'm converting this to a monthly snapshot table. Every record in this monthly table should look like what you see in the table below at 31-01.
If on the last day of the month the amount is negative, amount_negative_lastday_of_month = True. The part I can't figure out is the first_date_negative_amount. If the amount_negative_lastday_of_month = True, I want to get the first day on which the amount became negative for that specific period where the amount was negative. In the table below that would be 28-01-2021.
If this period of amount < 0 continuous on until the end of February, we will see the exact same in the Feb. monthly snapshot where amount_negative_lastday_of_month = True and amount_negative_lastday_of_month = 28-01-2021.
If this period of negative amount is over, and in a few months a new period of negative amount begins, I want to do the same again.
The problem is that I can't figure out how to group/window my data by varying periods of time where a certain condition is met (amount < 0).
How can I query this?
date
amount
last_day_of_month
amount_negative_lastday
first_date_negative_amount
26-1-2021
-10
27-1-2021
200
28-1-2021
-200
29-1-2021
-200
30-1-2021
-200
31-1-2021
-100
31-1-2021
TRUE
28-1-2021
1-2-2021
-122
2-2-2021
-222
3-2-2021
-322
How can I get the retained customer from the previous year?
1. Customer Retention...the most recent trailing 12 months vs the previous 12 months...exclude new business...what % of customers are we still selling to? Ideally 100%...
explaining the above statement:-
I need the percentage of customers who were retained this year from the previous year depending on sales. for example- 1,2,3,4,5 (This year) are the customers doing business with us this year and 1,2,3,4,6 (previous Year) are the customers doing business in the previous year. so what I am looking for is the number of customers who have been retained from the previous year is 1,2,3,4 is (Four) divided by the total number of customers whom we are doing business within the previous year 1,2,3,4,6 is (Five). If I can get this somehow the percentage calculation is simple. So the percentage of customers who have been retained is (4/5)*100 = 80%. I want to calculate this as a measure for all the years.
I have a measure that gives me the month over month change in budget. The measure is defined as:
Bugdet Month over Month:=if(and(sum(budget[Value])<>0;[Budget, Previous Month]<>0);sum(budget[Value])-[Budget, Previous Month];0)
Budget, Previous Month:=CALCULATE(sum(budget[Value]);PREVIOUSMONTH(tDate[Date]))
When I show Bugdet Month over Month in a pivot table, it shows the correct numbers, but it shows 0 in the grand total. Is it possible to make some change somewhere to make it show the sum of all changes in the grand total?
Rough take is create a third measure:
Budget Month over Month Final:=SUMX ( VALUES(tdate[Date]), [Budget Month over Month])
This will independently iterate over every month in the given cell and calculated Budget Month over Month and then SUM them together. So for the month row values in your pivot table, this will be the equivalent of the current Budget Month over Month measure.
And for the Grand Total it will then show the sum of each individual month in the pivot.
I'm having trouble creating a subquery in Access to cough up what I need:
Input: SalespersonID, Amount, Date
I need to find what SalespersonID exceeds $2000 in a month (easy) AND what day in that month the running sum of Amount for that month exceeded $2000 (argh!).
I can groupby and get the first month any salesperson sum Amount > $2000 but I just can't figure out how to get the first date in that month when the month running sum of Amount>$22000
So you've got running-total in your tags - what did you try?
I would create a temporary table and generate the running total, and derive the month using the 'Month' function, and also derive the day of the month. If you sort by month and day each month's data will give you a running total that is what you want. This means you go month-by-month, and calculate the temp table for all salespersons.
It's not super elegant, but it'll give you what you want.
I have three tables:
Charges
Payments
Adjustments
Each has a value, called Amount. There are no allocations done on this data, we are assuming the oldest Payments are paying the oldest Charges or Adjustments. Each Amount could be +ve or -ve.
I need to produce a report which shows the age of the debt, based on the current balance being in debt, where the balance is the sum of each Amount in all tables. However, the age of the debt must be the Age of the current debt. If an account was in debit in October, but was zeroed in November and then in Debit in February, the Age of the Debt would be February. In need to provide a 30, 60, 90 day breakdown of each account whose balance is outstanding.
Sorry if this isn't clear, but if you've done it before you'll know what I mean. Any pointers?
Just been playing with a pen and paper. Is this as simple as:
Amnt Current Debt at Time = Sum(Debits to Time) - Sum (All Credits)
So in SQL:
Convert All +ve Charges, -ve Adjustments or -ve Payments to Debits (UNION)
Convert all -ve Charges, +ve Adjustments or +ve Payments to Credits (UNION)
For each of your age points, get the Sum of Debits to that point and subtract all of the credits for all time. (SUM and GROUP BY)
Any problems with this?