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
DANIPAR
New Member

How to get monthly/weekly/daily averages from counting unique IDs

Hello,

 

I have data table with data (year, month, day, week) and unique #Id. I'm counting unique Id's for year/month/week/day.

 

YearMonthDayWEEK#Id
2019January21400Q4H00000ce0UHUAY
2019January21400Q4H00000ce0WDUAY
2019January21400Q4H00000ce0XaUAI
2019January21400Q4H00000ce1l0UAA
2019January22400Q4H00000ce2NbUAI
2019January22400Q4H00000ce44CUAQ
2019January22400Q4H00000ce4tiUAA
2019January23400Q4H00000ce58YUAQ
2019December34900Q4H00000gBZRWUA4
2019December34900Q4H00000gBZtBUAW
2019December34900Q4H00000gBZuYUAW
2019December34900Q4H00000gBZxDUAW
2019December125000Q4H00000h8jksUAA
2019December125000Q4H00000h8jreUAA
2019December125000Q4H00000h8kpPUAQ
2019December125000Q4H00000h8lrqUAA
2020February3600Q4H00000hBHkfUAG
2020February3600Q4H00000hBHKLUA4
2020February3600Q4H00000hBHLnUAO
2020February3600Q4H00000hBHLTUA4
2020August213400Q4K000001M37HUAS
2020August213400Q4K000001M3LsUAK
2020August213400Q4K000001M3LTUA0
2020August213400Q4K000001M3U1UAK
2020August243500Q4K000001M4ytUAC
2020August243500Q4K000001M5jmUAC
2020August243500Q4K000001M5kVUAS

 

My goal is to create a table with average counts of Id's per month/week/day of specified year. Something like this:

 

YearAverage count of Id's per MonthAverage count of Id's per WeekAverage count of Id's per Day
2020   
2019   
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@DANIPAR , Have a column like this in your table

Year week to [Year] & [WEEK]
Date: [Day] & "-" &[Month]& "-" &[Year]
Year of the month [Month]& "-" &[Year]

Next, create a measure such as

Week Avg ( divide(count(Table[#Id]), distinctcount(Table[Year Week]))
Split by Brackets (Count(Table[#Id]), distinctcount(Table[Date]))
Split Monthly Average(count(Table[#Id]), distinctcount(Table[Month Year ]))

View solution in original post

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hey, @DANIPAR

According to your description, you want to get average id counts per month/week/day of the specified year. You can follow in my footsteps:

  1. Create a calculated column:
Month Day = [Month]&"-"&[Day]

  1. Create three measures:
Average count of Id's per Month =

var _numberofid=DISTINCTCOUNT('Table'[#Id])

var _numberofmonth=DISTINCTCOUNT('Table'[Month])

return DIVIDE(_numberofid,_numberofmonth)
Average count of Id's per Week =

var _numberofid=DISTINCTCOUNT('Table'[#Id])

var _numberofweek=DISTINCTCOUNT('Table'[WEEK])

return DIVIDE(_numberofid,_numberofweek)
Average count of Id's per Day =

var _numberofid=DISTINCTCOUNT('Table'[#Id])

var _numberofday=DISTINCTCOUNT('Table'[Month Day])

return DIVIDE(_numberofid,_numberofday)

  1. Create a Matrix chart and place measures and columns, such as this:

v-robertq-msft_0-1604902966901.png

And you can get anything you want.

You can download my test pbix file here

Best regards

Qin Community Support _Robert Team

If this post helps,then consider Accepting it as the solution to help other members find it faster.

amitchandak
Super User
Super User

@DANIPAR , Have a column like this in your table

Year week to [Year] & [WEEK]
Date: [Day] & "-" &[Month]& "-" &[Year]
Year of the month [Month]& "-" &[Year]

Next, create a measure such as

Week Avg ( divide(count(Table[#Id]), distinctcount(Table[Year Week]))
Split by Brackets (Count(Table[#Id]), distinctcount(Table[Date]))
Split Monthly Average(count(Table[#Id]), distinctcount(Table[Month Year ]))

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