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
Anonymous
Not applicable

Getting two latest value two different column in different table

Hi all, I have some difficulties and i need some help. 

 

My task is to get the latest application date and also the latest status from that application date without using the power query, only the dax function(measure or column)

I have two tables which is 

 

Status 

ameng_0-1660006963410.png

 Student

ameng_3-1660007471773.png

Data Model

ameng_2-1660007030736.png

Current Result (not correct)

ameng_4-1660017337532.png

Expected Result

ameng_5-1660017404220.png

pbi file 

The issue is, for each student, i need to get the latest application date that he done, and after getting that, i need to filter it by latest status by that date. Two different filtering and i don't know to do it. Hoping that someone could help me, Thanks!

@v-cazheng-msft @tamerj1 @amitchandak @SpartaBI @lbendlin @tamerj1 

1 ACCEPTED SOLUTION

Hi,

Thank you for your message.

I created a measure for application date as well.

Please check the attached file, and please check if it suits your requirement.

Thank you.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Untitled.png

 

Status expected measure: =
VAR _latestdate =
    MAX ( Student[Application Date] )
VAR _maxstatuskey =
    MAXX (
        FILTER ( Student, Student[Application Date] = _latestdate ),
        Student[Application Status Key]
    )
RETURN
    IF (
        HASONEVALUE ( Student[Student ID] ),
        CALCULATETABLE (
            VALUES ( 'Status'[Status] ),
            'Status'[Application Status Key] = _maxstatuskey
        )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Hi Jihwan, the measure works fine as expected, thanks!

but in my actual file, it was having major performance issues (loading data). i believe this is due to the long dax queries in the measure. And i'm kinda lost on how to simplify it. Appreciate your insights on this again, thank you so much. 

Anonymous
Not applicable

Hi Jihwan_Kim, thank you for the prompt reply,
i have another question which is why when i include the application date into the chart it become like this and not showing the latest date it should be? I'm sorry for not telling the requirement earlier but the application date and status code should be shown also. 

output from your edited pbi (thank you again)

ameng_2-1660017562132.png

 

 

 

expected output

ameng_0-1660017472361.png

 

 

and i need to use the status code to do the filtering and not by application status key. Hoping you have a nice day and can guide me further on this, thank you !

Hi,

Thank you for your explanation.

I fixed the measure.

By the way, if you want to slice by Status, I think creating a new table is also the way.

I am not sure how your expected outcome looks like when slicing by STATUS, but please check the attached file.

I also create a new table.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Hi Jihwan, thank you again for your prompt reply, i really do appreciate your concern on this issue.

But apparently i'm still having the same result which is this, 

ameng_3-1660042407655.png

expected result(without selecting anything from the slicer), as you can see, it's showing the latest date and the latest status which is for example for student A2, there same status in the different latest date(rejected). the result that it should be is only on the latest one which is on 2 January. 

ameng_4-1660042507493.png

Hoping that you can provide your insights more on this, thank you!

Hi,

Thank you for your message.

I created a measure for application date as well.

Please check the attached file, and please check if it suits your requirement.

Thank you.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Works like wonders, Thank you for the helps!

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.

Top Solution Authors