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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How do I DAX a new table from the following:

Given the below, I would like the result to be two columns, with distinct contractnbrs in 1 column and the coresponding leasenumbers in another.  I only want one of each leasenumber, and no blanks.  I have tried groupby, but obviously don't know how to use it as it complains about the duplicate values in contractnbr.

 

jileigh_0-1698864093110.png

Thanks in advance for your help.

 

6 REPLIES 6
Dangar332
Super User
Super User

Hi, @Anonymous 

try below code

 

Measure 3 = IF(
              ISINSCOPE(Table1[contractor]), 
               CONCATENATEX (
                  CALCULATETABLE ( VALUES ( Table1[leasenumber] ) ),
                  Table1[leasenumber],
                   ", " ,         
                  Table1[leasenumber] 
                 ,ASC              
                ),
                BLANK()
            )

 

Dangar332_0-1699351238342.png

 

Shalini_T
Frequent Visitor

@Anonymous, Try this code in a calculated table,

New_Table = 
VAR _summarize = SUMMARIZE('Table','Table'[contractnbr],"leasenumber",MIN('Table'[leasenumber]))
RETURN _summarize

 

Shalini_T_0-1698866533961.png


Regards,
Shalini

Anonymous
Not applicable

It says the syntax for 'RETURN' is incorrect.

Anonymous
Not applicable

Also, need ALL the leasenumbers for each contractnbr.

tackytechtom
Super User
Super User

Hi @Anonymous ,

 

How about this:

Table 2 = 
SUMMARIZE (
    'Table',
    'Table'[contractbr],
   "MaxLeaseNumber", MAX ( 'Table'[leasenumber] )
)

 

You might need to change the aggregate function to your needs (max, min etc.)

 

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 

Anonymous
Not applicable

No, I need all the distinct leasenumbers.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors