Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ydundar
Frequent Visitor

how to get 3 months before measured date

Hi,

I created and formatted a date by sending  values 

DATE(YEAR(TODAY()), SELECTEDVALUE(Months[Month], MONTH(TODAY())),1) as measure.
 
I want to get 3 months before this calculated date. But I couldn't use DATEADD function because it doesn't accept a measure as date parameter. So what else can I do? Thanks in advance.
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @ydundar 

What's result do you want?

 

Method 1:

get a sum values in the past three months of the selected date

Create two tables

calendar = CALENDARAUTO()

filter table = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))

Capture23.JPG

Create measures

selected date = DATE(YEAR(TODAY()),SELECTEDVALUE('filter table'[month],MONTH(TODAY())),1)

Measure = CALCULATE(SUM('Table'[value]),DATESINPERIOD('calendar'[Date],[selected date],-3,MONTH))

Capture24.JPG

Method 2:

Get a table (for selected date 2019/9/1, table show date from 2019/6/2~2019/9/1)

Table 2 = DATESINPERIOD('calendar'[Date],[selected date],-3,MONTH)

 

Best Regards Maggie

Community Support Team _ Maggie Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @ydundar 

What's result do you want?

 

Method 1:

get a sum values in the past three months of the selected date

Create two tables

calendar = CALENDARAUTO()

filter table = ADDCOLUMNS(CALENDARAUTO(),"year",YEAR([Date]),"month",MONTH([Date]))

Capture23.JPG

Create measures

selected date = DATE(YEAR(TODAY()),SELECTEDVALUE('filter table'[month],MONTH(TODAY())),1)

Measure = CALCULATE(SUM('Table'[value]),DATESINPERIOD('calendar'[Date],[selected date],-3,MONTH))

Capture24.JPG

Method 2:

Get a table (for selected date 2019/9/1, table show date from 2019/6/2~2019/9/1)

Table 2 = DATESINPERIOD('calendar'[Date],[selected date],-3,MONTH)

 

Best Regards Maggie

Community Support Team _ Maggie Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-juanli-msft. That was so helpful.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.