Calculate fines for categories in stored procedure - sp

if the fines will be for Book
every day will be 1 Kč
if the fines will be for CD
every day will be 1Kč
if the fines will be for Games
every day will be 10 Kč
fine is automatically calculated when API is called and list of borrowed products is returned.
Fine value will be defined in appsettings per product type.
e.g.
I have 1 book, which has to be returned on Aug 10th, today is Aug 18th, API will return that fine = 8 (1 Kč per day)

Related

How to create No. Series with day, month and year numbers?

I want to generate No. Series in Business Central in the following format: C220715001
Where 22 is year number as 2022
07 is month number as July
15 is day number as today is 15-07-2022
001 is the invoice number (first generated invoice)
Is it possible to create a No. Series like this without creating 1 line per day?
That would require some development.

Show value from last day of the given month - SSRS Report Builder

In a Report Builder table I have to show the value from the last day of the given month, when the month is not expanded.
When the month is expanded, the dates have to show the specific value for that day.
Example is January with values 1 to 31 (same as the day numbers):
When January is expanded, it has to show value 1 on Jan 1.... value 15 on Jan 15... value 31 on Jan 31.
When contracted (and the table only show one row for January), it should show the last day's value of 31
Some months do not have values on all days, so the formula just need to take the last value of that given month
When I use the formula "Last()", then it works half of the time, while for some months, the value extracted is the 3rd or 4th last day of the month - do you know what is wrong here?
Hope above makes sense, and thanks for help.
I think I fixed it my self:
Using Last () formula
Learning how to make a sort order in my Union All dataset, so it came out in the right way
How to give points to my self?

Is there any DAX expression to find out the results?

As shown in images(link) that we have to count the no.of arrivals of a customer by cross checking with sessionStart. I need to represented the customer visits(count) based on the following trends: Once Every 3 Months / Once A Month / Once A Week / More Than Once A Week by using date field or (Session Start and Session End)?
Table name EDW_KLOUDSPOT_TXS
Power Bi visual

Multiple Column Groups within matrix for invoice grid

I have to present a matrix or tablix on a report which shows the invoices a customer has had in a given month. It needs to display like this. Where each week is a separate column - managed that - then the row grouping is by weekday e.g. Mon, Tues, that way all the invoices should sort in the same proximity.
When I group by the weekday I do not see all the invoices - there may be multiple invoices on a day. When I group by weekday, invoice number then the grid has four lists for each week but offsets the invoices in the row below each other week
I have honestly been working on this for ages and have tried every grouping an sorting I can think of but cannont get this to work. Tried searches but still cant find anything clear to help.
The Datasource is standard, used both SSAS and DAX separately to get data - that is not a problem as data is correct. Not sure how to display this layout in this form:
Week 1 Week 2 Week3 Week 4
Inv Amount Inv Amount Inv Amount Inv Amount
Mon Inv123 50 Inv130 450 Inv912 5
Inv124 500 Inv133 25
Tue Inv125 75 Inv245 75
Wed Inv126 85 Inv156 95 Inv315 15
Inv316 50
Thur Inv166 10
Fri Inv127 9 Inv451 15 Inv915 15

How many times does a range of values contain the end of the month

I have a table that has 2 values.
Value a phone was activated and a value when phone was deactivated.
I want to find out how many times that phone was still active on the last day of any given month.
Table1
phone1 DateActivated DateDeactivated HowManyTimesLastDayOfMonth
123 3/1/2016 3/15/2016 0
456 3/10/2016 6/25/2016 3
789 5/25/2016 10/10/2016 5
To amplify my comment:
SELECT phone1, DateActivated, DateDeactivated,
MONTHS_BETWEEN(FIRST_DAY(DateActivated+1), FIRST_DAY(DateDeactivated+1)) HowManyTimesLastDay
FROM mytable;
I should have explained better. The reason you take first_day(DateActivated+1) is that the second date (going to the first day of the next month) needs to be sure that it's not a full month - so if the phone was activated on March 1 and deactivated on March 25th, it doesn't show a full month. The reason for FIRST_DAY(DateDeactivated + 1) is to make sure that in the event that the deactivation occurred on the last day of a month that that counted towards the total.

Resources