cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PR20048119 Regular Visitor
Regular Visitor

Dax for Get count of distinct rows from measure

my table is below

 

Column1    Coulmn2

A                     1 

A                     1

A                     2

A                     2
A                     2
A                     3

 

output will be 3 as there are 3 unique rows.

 

Note: My source is tabular model so i can create only measures in power BI

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
gooranga1 Senior Member
Senior Member

Re: Dax for Get count of distinct rows from measure

Hi @PR20048119 

 

Create a calculated column that concatenates Column1 and 2 then distinct count that.

 

Count = Table1[Column1 ] & Table1[Coulmn2]
DistinctRows = CALCULATE(DISTINCTCOUNT(Table1[Count]))

data4.PNG

Community Support Team
Community Support Team

Re: Dax for Get count of distinct rows from measure

Hi @PR20048119 ,

 

One sample for your reference. Here we can create a measure as below.

 

Measure = SUMX(VALUES(Table1[Column1]),CALCULATE(DISTINCTCOUNT(Table1[Column2])))

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
tex628 Senior Member
Senior Member

Re: Dax for Get count of distinct rows from measure

Request is a little bit vague but a DISTINCTCOUNT([Column2]) should work i believe?

Br,
Johannes

Highlighted
gooranga1 Senior Member
Senior Member

Re: Dax for Get count of distinct rows from measure

Hi @PR20048119 

 

Create a calculated column that concatenates Column1 and 2 then distinct count that.

 

Count = Table1[Column1 ] & Table1[Coulmn2]
DistinctRows = CALCULATE(DISTINCTCOUNT(Table1[Count]))

data4.PNG

Super User
Super User

Re: Dax for Get count of distinct rows from measure

@PR20048119 

 

May be a MEASURE like

 

Measure = Countrows(DISTINCT(TableName))
Community Support Team
Community Support Team

Re: Dax for Get count of distinct rows from measure

Hi @PR20048119 ,

 

One sample for your reference. Here we can create a measure as below.

 

Measure = SUMX(VALUES(Table1[Column1]),CALCULATE(DISTINCTCOUNT(Table1[Column2])))

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.