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
Jachat
Regular Visitor

Dax Prior Year of Event Day ( text field) in date dimension. Different day/month each yer

We have events that are run every year. These events are in our Date Dimension as a text field, eg Mothers Day Lunch. The day/month is not the same every year. There are approx 50 events that are run annually.

 

In a power BI, if a user selects "Mothers Day Lunch" and Season 20/21, we would like to have a measure that shows comparative to prior 2 years.

How do we do this, as the field is not date format?

 

1 ACCEPTED SOLUTION

@Jachat , Try

=RANKX(all('Event Date'),'Event Date'[Racing Season],,asc,dense)

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Jachat , You need to have seprate date table, With Rank column suggested below on season/year.  on on season/event ( "Mothers Day Lunch").

Event should part of date table to should be in a seperate table

 

New column

Rank on Season = rankx(all(Date), [Season], ,asc,dense)

 

measure

This Year = CALCULATE(sum('Table'[Value]), FILTER(ALL('Date'),'Date'[Rank on Season]=max('Date'[Rank on Season])))
Last Year = CALCULATE(sum('Table'[Value]), FILTER(ALL('Date'),'Date'[Rank on Season]=max('Date'[Rank on Season])-1))

 

 

I am trying to do this in SSAS tabular model

 

Does this look correct? As its giving me an error

 

=RANKX(all('Event Date','Event Date'[Racing Season],,asc,dense))

@Jachat , Try

=RANKX(all('Event Date'),'Event Date'[Racing Season],,asc,dense)

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.