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
MCornish
Responsive Resident
Responsive Resident

Getting the last transaction date when using the date dimension

I have a model that (simplified) is:

 

Fact = Entries

Dimension = Date (marked as date table)

Dimension = Product

 

When I try to get the last date a product was sold I get the max date of my date dimension. I can't use the Fact table as the date key is an integer (20190820).

 

How can I tell PBI to only get it for the current row bound by the fact table?

1 ACCEPTED SOLUTION
MCornish
Responsive Resident
Responsive Resident

Ok. I kind of sorted it.

 

LOOKUPVALUE( Dates[Date], Dates[DateKey], MAX( 'Product Entries'[PostingDateKey] ) )
 
Not the most elegant of solution and I'm sure it can be improved upon. So please feel free to try and improve upon it.

View solution in original post

4 REPLIES 4
TeigeGao
Solution Sage
Solution Sage

HI @MCornish ,

In your scenario, you will need to create a date key (int data type) column in the Dimension = Date (marked as date table) table, then we can create relationship between these tables. 

Best Regards,

Teige

MCornish
Responsive Resident
Responsive Resident


@TeigeGao wrote:

HI @MCornish ,

In your scenario, you will need to create a date key (int data type) column in the Dimension = Date (marked as date table) table, then we can create relationship between these tables. 

Best Regards,

Teige


@TeigeGao The relationship already exists

 

Capture.PNG

 

All i can get when using ProductID from Products and the Date from the Date dimension is this

 

Capture2.PNG

MCornish
Responsive Resident
Responsive Resident

Ok. I kind of sorted it.

 

LOOKUPVALUE( Dates[Date], Dates[DateKey], MAX( 'Product Entries'[PostingDateKey] ) )
 
Not the most elegant of solution and I'm sure it can be improved upon. So please feel free to try and improve upon it.
Anonymous
Not applicable

Can you upload a sample file?

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.