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
flanshaw
Helper I
Helper I

Count of Occurances / reoccurance

Hi - I'm sure someone can help.

I've a data set with telephone numbers and date of call. I'd like to be able to show total number of times ANY number has been called more than once in the last 30 days and the number of unique numbers. In the example below i'm after a formula for the e value of 5 (unique numbers) and 2 (re occurant..). Plan is put these as a card in PBI desktop

 

Telephone    number date
012-345      28/06/2017
012-456      13/06/2017
012-478       16/06/2017
012-345       02/06/2017
012-345       02/04/2017
012-329       03/03/2017
012-333        03/03/2017
012-478        01/06/2017

Total number of calls 8
Total number of unique 5
re-occrancant numbers 2

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @flanshaw,

 

We need time intelligence functions here. Let's create a date table first.

Calendar =
CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2017, 12, 31 ) )

Then establish relationship.

Create three measures. (last 30 days)

TotalNumberOfCalls =
CALCULATE (
    COUNT ( 'Table1'[Telephone] ),
    DATESINPERIOD ( 'Calendar'[Date], TODAY (), -1, MONTH )
)
TotalNumberOfUnique =
CALCULATE (
    DISTINCTCOUNT ( Table1[Telephone] ),
    DATESINPERIOD ( 'Calendar'[Date], TODAY (), -1, MONTH )
)
ReOccrancant =
CALCULATE (
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                'Table1',
                Table1[Telephone],
                "Occurence", COUNT ( Table1[Telephone] )
            ),
            [Occurence] >= 2
        )
    ),
    DATESINPERIOD ( 'Calendar'[Date], TODAY (), -1, MONTH )
)

If you need exact 30 days or other, you could use "DATESINPERIOD" like this.

DATESINPERIOD ( 'Calendar'[Date], TODAY (), -30, DAY )

 

Count of Occurances  reoccurance.JPG 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @flanshaw,

 

We need time intelligence functions here. Let's create a date table first.

Calendar =
CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2017, 12, 31 ) )

Then establish relationship.

Create three measures. (last 30 days)

TotalNumberOfCalls =
CALCULATE (
    COUNT ( 'Table1'[Telephone] ),
    DATESINPERIOD ( 'Calendar'[Date], TODAY (), -1, MONTH )
)
TotalNumberOfUnique =
CALCULATE (
    DISTINCTCOUNT ( Table1[Telephone] ),
    DATESINPERIOD ( 'Calendar'[Date], TODAY (), -1, MONTH )
)
ReOccrancant =
CALCULATE (
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                'Table1',
                Table1[Telephone],
                "Occurence", COUNT ( Table1[Telephone] )
            ),
            [Occurence] >= 2
        )
    ),
    DATESINPERIOD ( 'Calendar'[Date], TODAY (), -1, MONTH )
)

If you need exact 30 days or other, you could use "DATESINPERIOD" like this.

DATESINPERIOD ( 'Calendar'[Date], TODAY (), -30, DAY )

 

Count of Occurances  reoccurance.JPG 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

Thanks Dale !

 

Works - easy when u know how

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.