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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Average per unique item per day per year

I must calculate number of unique items per day/365 days

My columns are:

[Fact table(Item Number)]

[Fact table(Start Date)]

 

Item NumberStart Date
E17010/12/2020
E12712/12/2020
C74223/12/2020
E12726/11/2020
A43505/11/2020
F73219/12/2020
E12717/12/2020
E12712/12/2020
E17012/12/2020
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

Please refer to my pbix file to see if it helps you.

Create relationships between the tables.

vpollymsft_1-1647925816880.png

 

Then create a measure.

Measure =
VAR days_ =
    DATEDIFF (
        MINX ( ALL ( 'Table 2' ), 'Table 2'[Date] ),
        MAX ( 'Table'[Start Date] ),
        DAY
    )
VAR _Distinct =
    DISTINCTCOUNT ( 'Table'[Item Number] )
RETURN
    DIVIDE ( _Distinct, days_ )

vpollymsft_0-1647925793309.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @Anonymous ,

Please refer to my pbix file to see if it helps you.

Create relationships between the tables.

vpollymsft_1-1647925816880.png

 

Then create a measure.

Measure =
VAR days_ =
    DATEDIFF (
        MINX ( ALL ( 'Table 2' ), 'Table 2'[Date] ),
        MAX ( 'Table'[Start Date] ),
        DAY
    )
VAR _Distinct =
    DISTINCTCOUNT ( 'Table'[Item Number] )
RETURN
    DIVIDE ( _Distinct, days_ )

vpollymsft_0-1647925793309.png

If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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

 

 

Ashish_Mathur
Super User
Super User

Hi,

Based on the data that you have shared, please show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AlexisOlson
Super User
Super User

This would average the items per day for all dates that appear in the Start Date column.

AvgItems =
AVERAGEX (
    VALUES ( Fact[Start Date] ),
    DISTINCTCOUNT ( Fact[Item Number] )
)

If you need something different, please specify how to treat dates that don't appear in your fact table and whether you want to partition by year or not, etc.

Anonymous
Not applicable

Hi @AlexisOlson 
I actually need to rephrase my question. 
This is what I must calculate: 
I must calculate the average number of usage.
How many times the unique number
 has been used per day over 2 years and 2 months. 

[Fact table(Item Number)]

[Fact table(Start Date)]


My calculations are based on 797 days (2 years and 2 months from Jan 2020 to end of Feb 2022)
In total I have 1.266,929 [Fact table(Item Number)]

but 4,165 distinct Item numbers (that distinct number was calculated as a measure:

Distinct Item numbers = DISTINCTCOUNT('Fact table'[Item number])


Your help would be very uch appreciated. 
Best,
Jola
 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.