Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel77
Creator
Creator

Max Month Year -1

Hi All,

Dates have ruined my afternoon and I need some help please.

I have an application loading data with a date field as follows:

Date(date#(POD,'MM/DD/YYYY hh:mm:ss TT'),'DD/MM/YYYY') as Date,

I need to run the report on a schedule on the 1st of the month showing all data from the previous month using the above  Date field. Can anyone offer some assistance please?

Thanks so much in advance.

Daniel

 

 

Labels (4)
10 Replies
poklegoguy
Creator
Creator

In this case, you should just use 2 dimensions for the table which is Portal Order No and Date and use if statement for the first dimension as below and untick 'Include Null Value', the ONLY function doesn't work like you did and measure need proper aggregation expression. For the second dimension, just use Date:
IF(Date >= MonthStart(Today(),-1) AND Date <= MonthEnd(Today(), -1), [Portal Order No])

If you have a master calendar table, which if you haven't, you should. You can use something like
IF(YearMonth = Date(AddMonths(MAX(YearMonth), -1), 'YYYY-MM'), [Portal Order No]) 

Just replace the year month format with the format you use in your data model.