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

Lookup value corresponding to max date and concatenate

I've two tables as under:

ORDER:

IDDATEPURPOSE
101-02-2020A
103-03-2020B
103-03-2020C
202-02-2020A
201-02-2020D
202-02-2020E
304-05-2020X
304-05-2020Y
304-05-2020Z
401-01-2020M
506-07-2020N

 

CUSTOMER:

ID
1
2
3
4
5
6

 

 

I'm wanting to match the ID's and extract the max date for each ID and also concatenate the PURPOSE's for those ID's

so the resulting table will be as under:

 

IDMAX_DATEPURPOSE
103-03-2020B,C
202-02-2020A,E
304-05-2020X,Y,Z
401-01-2020M
506-07-2020N
6  

 

 

Currently, to get the max date column I'm using the query below:

 

MAX_DATE =
VAR _MaxDate =
CALCULATE (
MAX ( ORDER[DATE] ),
FILTER ( ORDER,ORDER[ID] = CUSTOMER[ID] )
)
RETURN
LOOKUPVALUE (
ORDER[DATE],
ORDER[DATE], _MaxDate,
ORDER[ID], CUSTOMER[ID]

 

 

I'm not sure how do I get the PURPOSE column concatenated using the same or similar measure

1 REPLY 1
edhans
Super User
Super User

You would use the CONCATENATEX() function. The basics are 

 


Measure =
CONCATENATEX(
    TableName,
    ColumnOrExpression,
    ", "
)

 

There is an excellent article here using CONCATENATEX() to debug measureshttps://dax.tips/2020/06/24/dax-1-column-fusion-pt-2/#:~:text=Iterator%20functions%20can%20be%20powe... . Phil was at our PowerPlatform usergroup last week and showed this trick. Very cool. 

 

CONCATENATEX will easily grab a bunch of text and put it together in any order you like with the delimiter you choose.

If you need more help, can you give us data in a good table format? The above just pastes into Excel or PowerBI as a long string. See links below.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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