cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Return values related to selected ones

Hi all,

 

I have this datasource:

 

keyItem NumberProject IDProject Due Date
0948RCN-026202352
1937RCN-026202352
2801RCN-026202352
3302BJS-682202238
4143BJS-682202238
5989BJS-682202238
6791PPT-112202352
7702PPT-112202352
8476PPT-112202352
9446PPT-112202352

 

I have a slicer to select some project IDs

 

I want to have two text boxes: one to display all the project IDs selected, one to dislpay the related due date FOR EACH project.

 

I use this formula to display the projects:

 

 

selectedProjects = CONCATENATEX(VALUES(Table[Project ID]), [Project ID], UNICHAR(10))

 

 

 

And this one to display the due dates:

 

 

dueDate = CONCATENATEX(VALUES(Table[Project Due Date]), [Project Due Date], UNICHAR(10))

 

 

I obtain this:

Annotation 2022-05-18 164648.png

 

 

 

 

 

 

But expected result is this:

arthurld_0-1652885621866.png

It has to be dynamic when I select other projects...

 

Anyone can help me on this?

 

Thanks a lot

arthurld

 

1 ACCEPTED SOLUTION
sturlaws
Super User
Super User

Hi, @Anonymous,

the reason you only get two dates with your current measure is because VALUES returns the distinct values of the argument.

 

Could you try to write your measure like this instead:

dueDate =
CONCATENATEX (
    ADDCOLUMNS (
        VALUES ( 'Table'[Project ID] ),
        "tmp", CALCULATE ( MIN ( 'Table'[project due date] ) )
    ),
    [tmp],
    UNICHAR ( 10 )
)

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

1 REPLY 1
sturlaws
Super User
Super User

Hi, @Anonymous,

the reason you only get two dates with your current measure is because VALUES returns the distinct values of the argument.

 

Could you try to write your measure like this instead:

dueDate =
CONCATENATEX (
    ADDCOLUMNS (
        VALUES ( 'Table'[Project ID] ),
        "tmp", CALCULATE ( MIN ( 'Table'[project due date] ) )
    ),
    [tmp],
    UNICHAR ( 10 )
)

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors