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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pablors
Frequent Visitor

Distinct count by date

Hi everyone, 

 

First of all, sorry for my english, i´m not used to write in this language.

 

I have a problem with a measure. I don´t even know if i should use a measure or a calculated column. 

 

I have a table which look like this, it´s related to phone numbers which result can be a sale or not:

 

PHONE                       DATE                 SALE

600001                   01/09/2017              Y

600001                   02/09/2017              N

600002                   02/09/2017              N

600003                   03/09/2017              N

600003                   04/09/2017              Y

600004                   04/09/2017              Y

 

What i want is to paint that on a visual without making changes on the table itself. But i only want unique values by the first date. It would lok like this:

 

DATE                   SALE

01/09/2017            1

02/09/2017            0

03/09/2017            1

04/09/2017            1

 

Thanks in advange, and sorry again.

1 ACCEPTED SOLUTION

Thank you so much Eric, 

 

I found a simple solution after thinking calmly about the problem. 

 

I made a custom column and put it as the X axis in my chart. 

 

1era = CALCULATE(FIRSTDATE('Table1'[Date]); ALLEXCEPT('Table1'[Phone]))

 

Then I includes de registered phones and which are sales, and the ratio of succes

Captura.PNG

 

 

Thanks!

View solution in original post

2 REPLIES 2
Eric_Zhang
Employee
Employee


@pablors wrote:

Hi everyone, 

 

First of all, sorry for my english, i´m not used to write in this language.

 

I have a problem with a measure. I don´t even know if i should use a measure or a calculated column. 

 

I have a table which look like this, it´s related to phone numbers which result can be a sale or not:

 

PHONE                       DATE                 SALE

600001                   01/09/2017              Y

600001                   02/09/2017              N

600002                   02/09/2017              N

600003                   03/09/2017              N

600003                   04/09/2017              Y

600004                   04/09/2017              Y

 

What i want is to paint that on a visual without making changes on the table itself. But i only want unique values by the first date. It would lok like this:

 

DATE                   SALE

01/09/2017            1

02/09/2017            0

03/09/2017            1

04/09/2017            1

 

Thanks in advange, and sorry again.


@pablors

You can try to create a measure as below.

Measure =
VAR sales =
    CALCULATE (
        DISTINCTCOUNT ( Table1[PHONE] ),
        FILTER ( Table1, Table1[SALE] = "Y" )
    )
RETURN
    IF ( ISBLANK ( sales ), 0, sales )

Capture.PNG

Thank you so much Eric, 

 

I found a simple solution after thinking calmly about the problem. 

 

I made a custom column and put it as the X axis in my chart. 

 

1era = CALCULATE(FIRSTDATE('Table1'[Date]); ALLEXCEPT('Table1'[Phone]))

 

Then I includes de registered phones and which are sales, and the ratio of succes

Captura.PNG

 

 

Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors