how to use Datebetween command for two generic data interval

Jairo Andrade
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 8, 2023

Dear Friends

 

First of all, I am a beginner. I need help.  I created a code to provide me a spent hour in sub-tasks, as shown below (figure):

 

Aggregate(Filter(
[Time].[Day].Members,
DateBetween([Time].CurrentMember.StartDate,
'2023-01-25','2023-02-06')
))

CODE.jpg

It is used to build the graph below:

GRAPH.jpg

However, my report was created with fixed date.  I would like to create a code to capture the date range between 25th day from previous month and 6th day of current month, without to specify the year or month. Somebody could explain me how to modify this code to capture the range mentioned previously ? It must work with any sequencial two months ?

 

Thanks in advanced

 

Jairo

1 answer

0 votes
Jairo Andrade
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 8, 2023

Well, I found a solution. I am sharing here. If somebody has a better one, please share here.

 

Aggregate(
  IIf(Month(Now())=1,

    [Time].[day].DateMembersBetween(
    DateSerial(Year(Now())-1,12,25),
    DateSerial(Year(Now())-1,1,6)),

    [Time].[day].DateMembersBetween(
    DateSerial(Year(Now()),Month(Now()) - 1,25),
    DateSerial(Year(Now()),Month(Now()),6)
  )
)

 

CODE_FINAL.jpg

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events