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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
UDMH
Frequent Visitor

Grouping and unique values

Hi All,

This is my requirement, help me on this. Whether we can achieve this in Power BI.

This is my data for example,

CodeNameDescriptionTextAmount
1AAA  120
1AAADescrip 1 Text data 1130
1AAADescrip 1  100
2BBB Text data 250
2BBBDescrip 2Text data 2100
2BBBDescrip 2 100
2 Descrip 2 50



And, the output,

CodeNameDescriptionTextAmount
1AAADescrip 1Text data 1350
2BBBDescrip 2Text data 2300



3 ACCEPTED SOLUTIONS
Irwan
Super User
Super User

hello @UDMH 

 

please check if this accomodate your need.

 

create new table with following DAX.

Summarize =
SUMMARIZE(
    FILTER(
        'Table',
        'Table'[Description]<>BLANK()&&
        'Table'[Text]<>BLANK()
    ),
    'Table'[Code],
    'Table'[Name],
    'Table'[Description],
    'Table'[Text],
    "Amount",
    CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Code]))
)
Irwan_0-1729489055071.png

 


 

Hope this will help.

Thank you.

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

One of ways to create a new table is writing DAX formula something like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1729489598254.png

 

expected result table = 
	SUMMARIZECOLUMNS(
		Data[Code],
		Data[Name],
		Data[Description],
		Data[Text],
		FILTER(
			Data,
			Data[Name] <> BLANK() && Data[Description] <> BLANK() && Data[Text] <> BLANK()
		),
		"@Amount", CALCULATE(
			SUM(Data[Amount]),
			ALLEXCEPT(
				Data,
				Data[Code]
			)
		)
	)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

shafiz_p
Super User
Super User

Hi @UDMH ,
You could try the below simple version using Dax:

NewTable = 
SUMMARIZE(
    'Table',
    'Table'[Code],
    "Name", MAX('Table'[Name]),
    "Description", MAX('Table'[Description]),
    "Text", MAX('Table'[Text]),
    "Amount", SUM('Table'[Amount])
)

shafiz_p_0-1729490019842.png

 

Also, you could use power query group by transformation. See images below:

shafiz_p_1-1729490142173.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

Best Regards,

Shahariar Hafiz

View solution in original post

5 REPLIES 5
shafiz_p
Super User
Super User

Hi @UDMH ,
You could try the below simple version using Dax:

NewTable = 
SUMMARIZE(
    'Table',
    'Table'[Code],
    "Name", MAX('Table'[Name]),
    "Description", MAX('Table'[Description]),
    "Text", MAX('Table'[Text]),
    "Amount", SUM('Table'[Amount])
)

shafiz_p_0-1729490019842.png

 

Also, you could use power query group by transformation. See images below:

shafiz_p_1-1729490142173.png

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

Best Regards,

Shahariar Hafiz

Jihwan_Kim
Super User
Super User

Hi,

One of ways to create a new table is writing DAX formula something like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1729489598254.png

 

expected result table = 
	SUMMARIZECOLUMNS(
		Data[Code],
		Data[Name],
		Data[Description],
		Data[Text],
		FILTER(
			Data,
			Data[Name] <> BLANK() && Data[Description] <> BLANK() && Data[Text] <> BLANK()
		),
		"@Amount", CALCULATE(
			SUM(Data[Amount]),
			ALLEXCEPT(
				Data,
				Data[Code]
			)
		)
	)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
divyed
Super User
Super User

Hello @UDMH ,

 

Here is the dax based on your data.

// I have created a sample table named Sample_Table with 4 columns Code_Name, Description, Text and Amount.

//You can make use of Summerize function to achieve the same. 

SummarizedTable =
SUMMARIZE(
    Sample_Table,                         // Replace with your table name
    Sample_Table[Code_Name],                   // Group by Code
    "Description",
        MAXX(
            FILTER(Sample_Table, Sample_Table[Description] <> BLANK()), Sample_Table[Description]   // Get first non-blank Description
        ),
    "Text",
        MAXX(
            FILTER(Sample_Table, Sample_Table[Text] <> BLANK()), Sample_Table[Text]   // Get first non-blank Text
        ),
    "Total Amount",
        SUM(Sample_Table[Amount])          // Sum of Amount
)
 
divyed_0-1729489978275.png

 

 
I hope this will solve your problem.
 
Please mark this as solution if it has solved your problem. I appreciate your Kudos :).
 
Cheers
LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/
Chetan007
Frequent Visitor

Hii @UDMH 

Please try this code

Chetan007_0-1729489379918.png

 

Irwan
Super User
Super User

hello @UDMH 

 

please check if this accomodate your need.

 

create new table with following DAX.

Summarize =
SUMMARIZE(
    FILTER(
        'Table',
        'Table'[Description]<>BLANK()&&
        'Table'[Text]<>BLANK()
    ),
    'Table'[Code],
    'Table'[Name],
    'Table'[Description],
    'Table'[Text],
    "Amount",
    CALCULATE(SUM('Table'[Amount]),ALLEXCEPT('Table','Table'[Code]))
)
Irwan_0-1729489055071.png

 


 

Hope this will help.

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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