Forum Discussion

pd4000's avatar
pd4000
Frequent Visitor
8 years ago
Solved

concatenatex

Hi,

 

Looking for advice or a solution...

 

Imagine example

 

ProgramProjectNameOrderOnly ifWanted Result Column
AQBob1TRUEBob
Ryan
BWJames2TRUEJames
John
CETom4FALSEN/A
ARRyan3TRUEBob
Ryan
ATJohn5FALSEN/A
BYJohn5TRUEJames
John
CURyan3FALSEN/A


The wanted result is basically

Per project which has an associated program I want the names in the result column, with a line break, if the row has a true, with the results ordered by the order column. If the row has a false I want the result to display N/A

 

The formula I have tried, which does part of the solution, is CONCATENATEX(This table, Name, unichar(10), Order, ASC) as a measure.

 

This formula doesn't account for the only if so in each line the answer if produced. I have tried to use if("Only if"=TRUE then ....) but only as a custom column which isn't working and I can't do it as a measure. I also can't use a conditional column because I can't use a formula to give me the answer.

 

Thanks.

  • Hi pd4000,

    Based on my test, you can refer to below steps:

    1.I have entered some sample data:

    2.Create a calculated column and a measure:

    Calculated column:

    Filter Name = IF('Table1'[Only if]="TRUE",[Name],BLANK())

    Measure: F = IF(MAX('Table1'[Only if])="TRUE",

    LEFT(CONCATENATEX(ALL(Table1), 'Table1'[Filter Name],UNICHAR(10),'Table1'[Program]=MAX('Table1'[Program]),DESC),10),"N/A")

     

    3.Create a table measure add the related fields and you can see the result.

    You can also download the PBIX file to have a view.

    https://www.dropbox.com/s/y2j8rdhgtjuhmuy/concatenatex.pbix?dl=0

     

    Regards,

    Daniel He

2 Replies

  • v-danhe-msft's avatar
    v-danhe-msft
    Microsoft Employee

    Hi pd4000,

    Based on my test, you can refer to below steps:

    1.I have entered some sample data:

    2.Create a calculated column and a measure:

    Calculated column:

    Filter Name = IF('Table1'[Only if]="TRUE",[Name],BLANK())

    Measure: F = IF(MAX('Table1'[Only if])="TRUE",

    LEFT(CONCATENATEX(ALL(Table1), 'Table1'[Filter Name],UNICHAR(10),'Table1'[Program]=MAX('Table1'[Program]),DESC),10),"N/A")

     

    3.Create a table measure add the related fields and you can see the result.

    You can also download the PBIX file to have a view.

    https://www.dropbox.com/s/y2j8rdhgtjuhmuy/concatenatex.pbix?dl=0

     

    Regards,

    Daniel He

    • pd4000's avatar
      pd4000
      Frequent Visitor

      Hi Daniel,

       

      Thanks very much for your response! Unfortunately, it didn't quite work but it did place the N/As in the boxes that I wanted. I played around a bit with CONCATENATEX and some of your formula for the measure and I got one that solved it!

       

      Basically, I had

       

      Measure = if(max(table1[only if])="TRUE", CONCATENATEX(table1 , table1[name], UNICHAR(10), table1[order], ASC), "N/A")

       

      and that worked for me, so thank you very much for sending me your solution and linking the file, that was extremely helpful!

       

      Kind regards,

       

      Priyan