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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PCHMarc67
Regular Visitor

Last Date based on ID grouping in Table Dax Measure

Hello!  New to BI and this forum

I have a table with customer ID's and their last activity date.  I can drag this date field into a Card and set it to "latest" and by clicking on a visualization of customers this Card will change to the correct date.  Great!

 

But I cannot drag this same activity date field into a table visualization and choose "latest" -- it just duplicates every action record.

 

I've been trying to create a measure, thinking I need the GROUPBY and LASTDATE operators?

Last Move Date = (GROUPBY('22HC_2__ActionsDetails Q','22HC_2__ActionsDetails Q'[Constituent ID])),(LASTDATE('22HC_2__ActionsDetails Q'[Action Date].[Date])))    ... this doesn't work. I tried nesting it different ways
 
is there a way to see the DAX behind the working Card visualization -- that's all I need to reproduce
thanks!
Marc

 

 

1 ACCEPTED SOLUTION

Hi @PCHMarc67 ,

 

Maybe you can try this expression:

Measure =
CALCULATE (
    MAX ( 'Table'[Action Date] ),
    'Table'[Constituent ID] = SELECTEDVALUE ( 'Table'[Constituent ID] )
)

Then you need put the name field in the table firstly to group the table.

Result:

vchenwuzmsft_0-1650616763834.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
PCHMarc67
Regular Visitor

Let me Clarify... this is what the source table looks like.  lots of rows repeating my people.  So I want to create a measure that would group by Constituent ID then return the last Action Date (10/8/2021)    thx

PCHMarc67_0-1650392999956.png

 

Hi @PCHMarc67 ,

 

Maybe you can try this expression:

Measure =
CALCULATE (
    MAX ( 'Table'[Action Date] ),
    'Table'[Constituent ID] = SELECTEDVALUE ( 'Table'[Constituent ID] )
)

Then you need put the name field in the table firstly to group the table.

Result:

vchenwuzmsft_0-1650616763834.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is perfect!  thank you

tackytechtom
Super User
Super User

Hi @PCHMarc67 ,

 

How about something like this :

MeasureGroupBy = 
CALCULATE (
    MAX ( 'YourTableName'[Date] ),
    ALLEXCEPT ( YourTableName, YourTableName[Customer] )
)


Let me know, if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.