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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Distinct Count of Values Based on Two Columns

Hi, 

 

I have the following table:

 

 PBI_01.jpg

I'd like to create a third column to tell me the unique calls. All calls at the same time with the same phone number are calculated as one unique call. 

 

The result should be something like this: 

 

PBI_02.jpg

 

I tried the following but it didn't quite work out: 

AnotherTable = SUMMARIZE(journal;journal[StartTime];journal[PhoneNumber];"Distinct Count";DISTINCTCOUNT (journal[PhoneNumber]))

 

Has anyone an idea how I should get the required result?

 

Thanks

 

 

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

I tested with this formula, it returns the same result table as you provided above.

AnotherTable = SUMMARIZE(journal;journal[StartTime];journal[PhoneNumber];"Distinct Count";DISTINCTCOUNT (journal[PhoneNumber]))

1.PNG

 

Based on my assumption, the expected result of "DistinctCount" column should be 7, right?

AnotherTable =
VAR temptable =
    SUMMARIZE (
        journal,
        journal[StartTime],
        journal[PhoneNumber],
        "Distinct Count", DISTINCTCOUNT ( journal[PhoneNumber] )
    )
RETURN
    SELECTCOLUMNS (
        temptable,
        "StartTime", [StartTime],
        "PhoneNumber", [PhoneNumber],
        "DuniqueCalls", COUNTROWS ( temptable )
    )

1.PNG

 

Best regards,

Yuliana Gu

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

hi Yuliana Gu, 

If I run this formula, it gives me the result below. For example at 08:54:58, I have 5 discount counts from the same phone number, I would only like one of these calls from this phone number to be counted at 08:54:58.

PBI_03.jpg

 

If I run the other command, I get the following:

 

PBI_04.jpg

Hi @Anonymous,

 

Please add [StartTime] and [PhoneNumber] fields into table visual and choose "Count(distinct)" to check if the results are correct. The distinct count results should be smaller than total row numer of table 'journal'.

1.PNG

 

If results are incorrect, please locate to Query Editor, Trim the fields to remove the invisible characters inside text.

2.PNG

 

Best regards,

Yuliana Gu

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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors