Crystal reports Crosstab date grouping. - crystal-reports

I've created a report using the crosstab control which groups the data by date in columns. I'd like to take all of the dates that are earlier than the 1st of the current month (when the report is run) and combine them and the data being summarized into one column called Previous.
So instead of seeing something like this:
Oct Nov Dec Jan Feb Mar Apr May Jun Jul
I've see something like this:
Previous Jan Feb Mar Apr May Jun Jul
Is there a way of doing this in CR XI?

You would have to create a formula to do this (or probably two formulas one to get them in the correct order and another to display the correct string):
grouping formula: if {table.datefield} < currentdate then '0000' else cStr({table.datefield}, 'yyMM')
display formula: if {table.datefield} < currentdate then 'Previous' else cStr({table.datefield}, 'MMM')
ADDED SCREENSHOT

The answer was actually a modification of Lee's answer.
if {Command.ReqDate} < date(year({?StartDate}),month({?StartDate}),1) then dateadd('m',-1,{?StartDate}) else {Command.ReqDate}
use this to group on in the CT set to monthly
right click on the column header
select Format field,
select common tab
select display string formula
if currentfieldvalue < date(year({?StartDate}),month({?StartDate}),1) then 'previous'
else totext(currentfieldvalue,'MMM')

Related

Power BI - Date Format

I'm attempting to change the date format of a column from 01 Jan 2021 to 01 Jan 21 but it looks like that's not one of the formats available in power Bi. Is there a formula that might do this for me?
Kind regards,
Cian
Is possible to do what you want without using any formula.
First, go to the Model View and select the desired column. In my case is Date2. Then open the Properties tab that is at the left.
Now, go to Formatting, select Custom and at the Custom format textbox paste d MMM yy
By doing that you should get the expected result.

DAX Expression for calculating end of every year

I am looking for DAX expression to show me monthly figure for last financial years. Here is an example of the information;
The figure is accumulated since the starting of 31 Jan 2017 or earlier which I have no information. The data I have does not have a monthly view but Year to Date (YTD).
How could I structure the DAX so that it would be able to find out what is the figure for the month.
For example, Jan 2017 $2,000 , Feb 2017 $5000 (included figure from Jan 2017), March 2017 $8000 (included Jan 2017 and Feb 2017).
How can it be done to have the monthly view ?
Date............. Balance Sheet Amount.......View
31-Dec 2017................24,000.......................YTD *1
31-Jan 2018................24,010.......................YTD *1
28-Feb 2018................24,310.......................YTD *1
31-Dec 2018................30,000.......................YTD *2
31-Dec 2019................31,000.......................YTD *3
31-Dec 2020................40,000.......................YTD *4
30-June 2021................5,000.......................YTD *5
Let's say your current table does not contain previous balance, then it will be easier to obtain the current month movement with the following formula:
Current Month = Sheet1[YTD Bal] -
CALCULATE(SUM(Sheet1[YTD Bal]),
FILTER(Sheet1,Sheet1[Index] = EARLIER(Sheet1[Index]) - 1))
Before you start the dax calculation, you will need to add index column first and here is the output:

Google Sheets | Return last Friday's date on Sat to Wed apart from Thu and Fri

I'm a bit rubbish on Google Sheets formulas... would anyone be so kind to tell me how to achieve this ?
I'd like to have a cell that returns the last Friday's date on Sat to Wed, and instead the current date for Thursdays and Fridays.
Is it possible ?
e.g. this coming days:
Sat to Wed returns Friday 12th of March
Thu 18th returns Thu 18th
Fri 19th return Fri 19th
... and so on.
Thanks!
There are many ways to accomplish this, but try this:
=IF((WEEKDAY(TODAY())=5)+(WEEKDAY(TODAY())=6),TODAY(),TODAY()-VLOOKUP(WEEKDAY(TODAY()),{7,1; 1,2; 2,3; 3,4; 4,5},2,FALSE))
This formula is based on the us default numbers for weekdays, where Sunday = 1. If this formula produces unexpected results, your locale may be one where Monday = 1. In this case, you'll need to adjust as follows:
=IF((WEEKDAY(TODAY())=4)+(WEEKDAY(TODAY())=5),TODAY(),TODAY()-VLOOKUP(WEEKDAY(TODAY()),{6,1; 7,2; 1,3; 2,4; 3,5},2,FALSE))
Other things to keep in mind:
The + in (WEEKDAY(TODAY())=5)+(WEEKDAY(TODAY())=6) means OR (where * would mean AND).
The VLOOKUP is looking up the weekday of TODAY() within a simple virtual array, which is formed between the curly brackets and which instructs how many days to subtract from TODAY() given the current weekday in order to arrive at the previous Friday.

Month Start Date through DAX formula

I have dates in data from
02 Aug 2018
03 Aug 2018
04 Aug 2018
.
.
.
.
30 Aug 2018..
Now i want start of the month date through Dax formula which is 01/08/2018. But in data date is 02/08/2018 which i dont want
i tried below formula
Start_Monthdate = STARTOFMONTH(EStart_Date[Date])
through above formula i get 02 Aug 2018 which i dont want
In DAX, what you can do is use the EOMONTH function.
https://dax.guide/eomonth/
Column Name = EOMONTH(table[date], -1) + 1
So the above DAX is finding the end of the previous month, then adding 1 day to it.
For the date 2/4/2020, EOMONTH gets the date 31/3/2020, then adds one day to get 1/4/2020
Time intelligence only works reliably if you use it on a calendar table that has all the dates in the year you're working with. Since your date column is missing the first day of the month, STARTOFMONTH returns the first one that you do have.
Without creating a proper calendar table, you either use EOMONTH as #Jonee mentioned or try this:
DATE ( YEAR ( EStart_Date[Date] ), MONTH ( EStart_Date[Date] ), 1 )

How to simplify this spreadsheet formula?

I am working on my personal financial spreadsheet, and I have one table that lists columns like: "Month","Income",Expense","Notes", and I am building a 2nd table to use to build a new chart so I can view Year over Year comparisons to the data (ie, I will get all of the Januarys' data charted next to each other to compare).
Here is the formula I'm using to transpose this data, but I know there has to be a better way, but my searching is failing me:
=arrayformula({
filter(B5:B64,MONTH(B5:B64)=1);
filter(B5:B64,MONTH(B5:B64)=2);
filter(B5:B64,MONTH(B5:B64)=3);
filter(B5:B64,MONTH(B5:B64)=4);
filter(B5:B64,MONTH(B5:B64)=5);
filter(B5:B64,MONTH(B5:B64)=6);
filter(B5:B64,MONTH(B5:B64)=7);
filter(B5:B64,MONTH(B5:B64)=8);
filter(B5:B64,MONTH(B5:B64)=9);
filter(B5:B64,MONTH(B5:B64)=10);
filter(B5:B64,MONTH(B5:B64)=11);
filter(B5:B64,MONTH(B5:B64)=12)
})
This just seems so unwieldy, though it does what I want. Any suggestions on how to simplify this a bit?
EDIT: for clarifications, I'm taking data that is like: Jan 2015; Feb 2015; Mar 2015; etc, and transposing it to: Jan 2015; Jan 2016; Jan 2017; Feb 2015; Feb 2016; Feb 2017 etc.
Formula
=ARRAY_CONSTRAIN(SORT({B5:B64,MONTH(A1:A24)},2,TRUE),COUNTA(B5:B64),1)
Explanation
{B2:B64,MONTH(B5:B64)} is a custom array of two columns, the input and a column of months.
The SORT function sorts the custom array
The ARRAY_CONSTRAIN function removes the column of months.