I want to compare data from the current period (e.g current month) with the previous period (e.g. last month).
Let's say I have the following dataset:
date
orders
2020-01-01
1
2020-01-02
2
2020-01-03
5
2020-02-01
4
2020-02-02
2
And I want to get:
Jan 2020 Orders
Feb 2020 Orders
Delta Orders
8
6
-25%
Period can be selected by user.
the way I reached your desired outcome is by creating a calculated filed "MoM Change":
percentDifference(sum({ orders}), [date ASC], -1, [])
Also, this tutorial might be helpful: https://learnquicksight.workshop.aws/en/business-level-up.html
I was hoping to upvote the example above as it helped me solve this problem. I'm not yet to a reputation of 15 (how embarrassing) so I can't yet do that. But thank you #chrigu for the help.
In researching this, I found that QuickSight has extended this with a few similar functions. I used this one, which works with less parameters:
periodOverPeriodPercentDifference(measure, date, period, offset))
https://docs.aws.amazon.com/quicksight/latest/user/periodOverPeriodPercentDifference-function.html
There are several other variants for periodTo___ and periodOver___ to check out as well.
Related
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.
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?
I am using pandas & I have a dataframe with Date, Item#, Qty and 12 months of sales data. I want to do a std dev calc to understand the monthly variability for each Item#.
The problem is for many Item#'s the sales are sporadic: I may only sell Item XYZ in Feb and Mar, and zero the rest of the months of the year.
I am using this code to do the heavy lifting:
df.groupby('Item#').resample('M').sum()
For some Item#'s it is forcing zeros into the empty months (GOOD!), but in many cases it is just showing, say, two months of data, instead of 12, which then makes the std dev calculation incorrect.
Can someone help me understand why this behaviour of the .resample method? How can I workaround this problem?
Many thanks in advance for your help!
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
I have to work with data retrieved and grouped on a weekly basis (ISO week) and my DB is structured on a daily basis (field: DATE). I need to write down a code which is rolling, so that given the current date, it calculate the week and the retrieve data in the previous 3 weeks, too.
So I write in the WHERE clauses:
TO_DATE(TO_CHAR(DATE, 'YYYYWW')) BETWEEN TO_DATE(TO_CHAR(TO_DATE(running_date, 'YYYYMMDD'), 'YYYYWW'), 'YYYYWW')-3 AND TO_DATE(TO_CHAR(TO_DATE(running_date, 'YYYYMMDD'), 'YYYYWW'), 'YYYYWW')
It doesn't seems to work though.
Any suggestions on how to handle the problem?
Thanks a lot!
You have to subtract 21 days when you want to recive the previous 3 weeks. If you subtract 3 then you recive only the last three days.
You need to use 'IW', not 'WW' as the format mask for ISO week. From the Oracle docs:
IW = Week of year (1-52 or 1-53) based on the ISO standard.
WW = Week of year (1-53) where week 1 starts on the first day of the year and
continues to the seventh day of the year.