cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
sbuster
Helper I
Helper I

DAX remove duplicates or groupby

Hello, I have the follow dataset that has been denormalized (columns A-D).  The result I'm looking for is in column G/H.  I simply wanto a count of the Type field grouped by AnalyticID.  As you can see in the data, a given AnalyticID will have multiple rows because of the Input column but for the most part AnalyticID and Type will be one-to-one, so if I could remove duplicates based on AnalyticID+Type, and then groupby it would work, but I can't quite figure out how to do that.

sbuster_0-1673532201628.png

 

Any help would be appreciated.

2 ACCEPTED SOLUTIONS
Mikelytics
Resident Rockstar
Resident Rockstar

Hi @sbuster 

 

Please try the following:

 

Data in Power BI (Table Name = SampleTable)

Mikelytics_0-1673534270218.png

 

Measure 

Mikelytics_1-1673534398181.png

DistinctCount Analytical ID = DISTINCTCOUNT(SampleTable[AnalyticID])

 

Result after putting int visual:

Mikelytics_2-1673534450052.png

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

 

 

 

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table.

 

Jihwan_Kim_0-1673534780484.png

 

 

New table =
GROUPBY (
    SUMMARIZE ( Data, Data[AnalyticID], Data[Type] ),
    Data[Type],
    "@Count", SUMX ( CURRENTGROUP (), 1 )
)

 

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.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table.

 

Jihwan_Kim_0-1673534780484.png

 

 

New table =
GROUPBY (
    SUMMARIZE ( Data, Data[AnalyticID], Data[Type] ),
    Data[Type],
    "@Count", SUMX ( CURRENTGROUP (), 1 )
)

 

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.


Go to My LinkedIn Page


That seems to do the trick.. both responses worked but I accepted this as the solution as I was looking to do this in dax.

 

Mikelytics
Resident Rockstar
Resident Rockstar

Hi @sbuster 

 

Please try the following:

 

Data in Power BI (Table Name = SampleTable)

Mikelytics_0-1673534270218.png

 

Measure 

Mikelytics_1-1673534398181.png

DistinctCount Analytical ID = DISTINCTCOUNT(SampleTable[AnalyticID])

 

Result after putting int visual:

Mikelytics_2-1673534450052.png

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

 

 

 

 

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors