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
SJHA
Helper I
Helper I

Latest date across two tables using DAX

I have two tables:

Project:

[Project_title] [Project_module]

A                     A

A                     B

A                     C

B                     D

B                     E

C                     F

 

Usage:

[Project_module] [Latest_date]

A                     01-02-23

B                     02-02-23

C                     03-02-23

D                     01-02-23

E                     02-02-23

F                     04-02-23

 

Relation between the tables is [Project_module].

I would like to look at the latest date but on project title level. How can I use DAX to do that? I've been trying MAXX and I can't seem to figure it out.

2 ACCEPTED SOLUTIONS
Anand24
Super User
Super User

Hi @SJHA ,
Try the below calculated measure:

Title Level Latest Date = 
CALCULATE(
    MAX(Usage[Latest Date]),
    ALLEXCEPT(Project, Project[Project Title])
)

Here's the output:

Anand24_0-1679563294068.png

 

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

View solution in original post

Hi @SJHA ,
The measure I mentioned earlier would still work:

Anand24_0-1679574220448.png

Can you change the relationship to below?

Anand24_1-1679574243690.png


If relationship can't be shared, can you share the current relationship between these 3 tables please.

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

 

View solution in original post

8 REPLIES 8
SJHA
Helper I
Helper I

@Anand24 

 

SJHA_0-1679572152427.png

I have 3 tables: Project, Module and Usage

 

Currently it looks like the table in the lower right corner, or if I removed the 'module' column it just repeats the project with different dates.

 

I would like it to be the project name once for the latest date.

Hi @SJHA ,
The measure I mentioned earlier would still work:

Anand24_0-1679574220448.png

Can you change the relationship to below?

Anand24_1-1679574243690.png


If relationship can't be shared, can you share the current relationship between these 3 tables please.

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

 

Ahmedx
Super User
Super User

measure = 
MAXX( 
FILTER(AL('Usage'),
    'Usage'[Project_module]= max('Project'[Project_module]),[Latest_date]
)

----
Colum = 
MAXX( 
FILTER(AL('Usage'),
    'Usage'[Project_module]= 'Project'[Project_module],[Latest_date]
)
SJHA
Helper I
Helper I

@Anand24 

I just found out that the relation is not as I mentioned.

 

The relation is through another table:

SJHA_3-1679565543314.png

Project relation is Module parent_ID

Usage relation is Module ID

 

Is it still possible?

@SJHA ,
We should be able to solve it using DAX but I'm not exactly able to identify the table and relationship in the reply.
Is it possible for you to create a dummy .pbix file and share? Or can you share the table info just like you shared in original post?

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

Anand24
Super User
Super User

Hi @SJHA ,
Try the below calculated measure:

Title Level Latest Date = 
CALCULATE(
    MAX(Usage[Latest Date]),
    ALLEXCEPT(Project, Project[Project Title])
)

Here's the output:

Anand24_0-1679563294068.png

 

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

@Anand24 
Its doesn't work quite as you've shown.

SJHA_2-1679565010561.png

 



SJHA_0-1679564785547.png

SJHA_1-1679564970355.png

 

 

 

What might have happened here?

@SJHA ,
Can you try adding CROSSFILTER function in your query? Currently the filtering is not getting hit since the relationship is uni-directional.

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

 

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.