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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Fusilier
Regular Visitor

Help with creating a custom column

Trying to get to grips with DAX creating a custom column. I want to create a custom column 'LY' that shows the value 12 months previously before the current date in mt 'Location Data' table.

54a370bc-d6d5-463e-bc2e-da7bb0513450.jpg

For example, I want to create a column 'LY' that shows the value for 01-Feb-2022 (3) next to the value for 01-Feb-2023 (1) and so on. I'm sure this is easy, but I can't get my head around it!

1 REPLY 1
FreemanZ
Super User
Super User

hi @Fusilier 

try to add a calculated column like:

LY =
MAXX(
    FILTER(
       data,      data[category]=EARLIER(data[category])&&data[subcategory]=EARLIER(data[subcategory])&&data[month]=EDATE(EARLIER(data[month]), -12)
    ),
    data[Value]
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.