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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jd8766
Helper II
Helper II

Get latest value from FACT table?

Hi, I have a customer dimension structured like the below

jd8766_0-1690915629164.png


I have a FACT table like the below (joined using CustomerKey)

jd8766_1-1690915749083.png



I want to add a column to my customer dimension table which gets me the latest Product Name, and Order Date from the FACT table where OrderComplete = 0. It should get me the one that has the latest Order date...So this would give me an output of the below

jd8766_2-1690915890412.png

How could I build this calculated column using DAX?
Thanks

1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

LatestProductName =
MAXX(
    TOPN(
        1,
        FILTER( RELATEDTABLE( 'FACT' ), 'FACT'[OrderComplete] = 0 ),
        'FACT'[OrderDate]
    ),
    'FACT'[ProductName]
)
LatestProductDate =
CALCULATE( LASTDATE( 'FACT'[OrderDate] ), 'FACT'[OrderComplete] = 0 )

ThxAlot_0-1690920724566.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



View solution in original post

2 REPLIES 2
ThxAlot
Super User
Super User

LatestProductName =
MAXX(
    TOPN(
        1,
        FILTER( RELATEDTABLE( 'FACT' ), 'FACT'[OrderComplete] = 0 ),
        'FACT'[OrderDate]
    ),
    'FACT'[ProductName]
)
LatestProductDate =
CALCULATE( LASTDATE( 'FACT'[OrderDate] ), 'FACT'[OrderComplete] = 0 )

ThxAlot_0-1690920724566.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try creating a these measures:

 

Measure= CALCULATE(VALUES(Transactions[Product Name]),USERELATIONSHIP(Customer[Customer Key],Transactions[Customer Key]),LASTDATE(Transactions[Order Date]))
 
Measure 2 = CALCULATE(VALUES(Transactions[Order Date]),USERELATIONSHIP(Customer[Customer Key],Transactions[Customer Key]),LASTDATE(Transactions[Order Date]))
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
 
 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.