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
raj777karthik
Employee
Employee

need last 18 months of data

I have creation date column in which i need to see past 18 months of data from max created date ,If it is created in last 18 months from max creation date then it will be yes else no.Need to create calculate column

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@raj777karthik , Based on what I got. In your, date table joined with the table have this column ( or in table)

 

new column flag=

var _max  = max(Table[Date])

var _min = date(year(_max), month(_max)-18, day(_max))

return

if([Date]>= _min && [Date] <= _max, "Last 18", "Other')

 

 

or a new measure

var _max  = max(Table[Date])

var _min = date(year(_max), month(_max)-18, day(_max))

return

calculate(sum(Table[Value]), filter(Table, Table[date] >=Min && Table[Date] <=_max))

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@raj777karthik , Based on what I got. In your, date table joined with the table have this column ( or in table)

 

new column flag=

var _max  = max(Table[Date])

var _min = date(year(_max), month(_max)-18, day(_max))

return

if([Date]>= _min && [Date] <= _max, "Last 18", "Other')

 

 

or a new measure

var _max  = max(Table[Date])

var _min = date(year(_max), month(_max)-18, day(_max))

return

calculate(sum(Table[Value]), filter(Table, Table[date] >=Min && Table[Date] <=_max))

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.