0

Need to display only the primary company contact when printing

Hello and thanks in advance for all your support!

I have a table called "Companies" and created a second table called "Related Contacts" recording all contacts related to company "X" and added a field called "primary" for the company's main contact.

I need to print company "X" data and only the primary contact but all contacts are showing.

Can you please help on how to insert in my report a field selecting only the related contact marked as "primary" contact? (remark: the "primary" is a selection box showing "Yes" or "No").

Thanks again!

Pedro

6 replies

null
    • Riccardo.1
    • 3 yrs ago
    • Reported - view

    first('related contacts'[primary = true].'FieldName')

    • Pedro
    • 3 yrs ago
    • Reported - view

    Thanks Riccardo! It worked fine but now I need to concatenate additional data, for example, for now I have the 'first name' but also need to add other data, such as :
    What I have: first('Related Contacts'[Primary = true].'First Name')

    Now I need: 'First Name' + 'Last Name' + 'Cell' + 'Work Email'

    How to concatenate in the same formula you assisted above?

    Thanks in advance!!

    • Pedro
    • 3 yrs ago
    • Reported - view

    Riccardo, after your reply I just duplicated every code and got it done; see below:

    first('Related Contacts'[Primary = true].'First Name') + " " + first('Related Contacts'[Primary = true].'Last Name') + ", " + first('Related Contacts'[Primary = true].'Dept.') + ", " + first('Related Contacts'[Primary = true].Phone) + ", " + first('Related Contacts'[Primary = true].'Work Email') 

     

    Thanks again for your great assistance and support!!!

    • Riccardo.1
    • 3 yrs ago
    • Reported - view

    I would write it like this:

    let myFirstName:= first('Related Contacts'[Primary = true].'First Name');

    let myLastName:= first('Related Contacts[Primary = true].'Last Name');

    let myCell:= first('Related Contacts[Primary = true].'Cell');

    let myEmail:= first('Related Contacts[Primary = true].'Work Email);

    myFirstName + " " + myLastName + " " + myCell + " " + myEmail 

    Like this it will be written all in one line with a space in between ( you can also add a comma: ", " or whatever seperator you prefer). Or if you want to start a new line for every field:

    myFirstName + " " + myLastName + "

    " + myCell + "

    " + myEmail

    • Riccardo.1
    • 3 yrs ago
    • Reported - view

    Sorry my post was already too late. It essentially the same as you did. :)

    • Pedro
    • 3 yrs ago
    • Reported - view

    Thanks Riccardo! It was also great to learn more about the best practices! I will change the code as you advised!
    Again, thank you very much for all your assistance and support!

Content aside

  • 3 yrs agoLast active
  • 6Replies
  • 406Views