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
GlitchedDuck
Frequent Visitor

Average Count Per Day/Week/Month Card

Hi All,

 

I'm trying to create a few card visualization that shows average amount of invoices per Day/Week/Month.

 

In my data i have created_date, Invoice_Number and want to show the average in a card.

 

Is this possible?

 

Thanks

12 REPLIES 12

I would like for there to be a solution for this topic as I have a similar issue. I had a very well working Measure until we passed to the new fiscal year and it all fell apart. 

 

Measure 1:

Irrigation Inspection Count = 
    CALCULATE(DISTINCTCOUNT(WCTS_INSPECTION[REQUEST_ID]),
WCTS_INSPECTION[INSPECTION_TYPE] = "IRR")


 

Measure 2:

Average Irrigation Audits per Week = 
VAR CurrentFiscalWeek = MAXX(FILTER(ALL(DimDate), DimDate[Date] = TODAY()), DimDate[Fiscal WeekNumber])
return
[Irrigation Inspection Count]/CurrentFiscalWeek

 

Once I started the new fiscal year, it divided the total inpection count (208) from the previous fiscal year by the current fiscal week number (2).

 

AverageX function is giving me an incorrect result of 4.43, rather than 4 (208/52).

Avg = AVERAGEX(VALUES(DimDate[Fiscal WeekNumber]),[Irrigation Inspection Count])

 

Figured out the issue I was having. I just needed to make a slight modification to Measure 2

 

Average Irrigation Audits per Week = 
VAR CurrentFiscalWeek = MAX(DimDate[Fiscal WeekNumber])
return
[Irrigation Inspection Count]/CurrentFiscalWeek

 

v-jayw-msft
Community Support
Community Support

Hi @GlitchedDuck ,

 

Please check the following measures.

_day = calculate(average([invoice_number]),filter(allselected('table'),[create_date] = selectedvalue([create_date])))

_month = calculate(average([invoice_number]),filter(allselected('table'),month([create_date]) = month(selectedvalue([create_date]))))

_week = calculate(average([invoice_number]),filter(allselected('table'),weeknum([create_date]) = weeknum(selectedvalue([create_date]))))

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
johnt75
Super User
Super User

Average per day = AVERAGEX( ADDCOLUMNS( VALUES(date_dim[full_date - No Time]), 
   "@val", CALCULATE([Invoice Count]) ), [@val])

Average per month = AVERAGEX( ADDCOLUMNS( SUMMARIZE( date_dim, date_dim[Year month]),
   "@val", CALCULATE([Invoice Count]) ), [@val])
Tahreem24
Super User
Super User

@GlitchedDuck, Better to share the dummy data here (not screen shot) to understand your need.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Created_DateInvoice_Number
24/03/20221
24/03/20222
24/03/20223
24/03/20224
24/03/20225
24/03/20226
23/03/20227
23/03/20228
23/03/20229
22/03/202210
22/03/202211
22/03/202212
22/03/202213
22/03/202214
21/03/202215
21/03/202216
21/03/202217
21/03/202218
21/03/202219

@johnt75 Create one seperate Calendar table like below:

Calendar = CALENDAR(MIN(CreatedDate),MAX(CreatedDate))

Then create a different columns under this table:

MONTH = MONTH(Calendar[Date])

YEAR = YEAR(Calendar[Date])

DAY = DAY(Calendar[Date])

 

Then create a below Measures under your invoice table,

Avg Invoice per Month = CALCULATE(SUM(InvoiceTable[Invoice_Number]),ALLSELECTED('Calendar'[Month]))
 
Like wise just create for DAY and Year measure by chahing the ALLSELECTED funtion respectively.
 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
davehus
Memorable Member
Memorable Member

Hi @GlitchedDuck ,

 

Assuming you are looking to discount invoices in your fact table.

 

Invoice Count = DISTINCTCOUNT(Table[InvoiceColumn]) 

 

Day = Averagex(Values(DateTable[Day]), [Invoice Count])

Week = Averagex(Values(DateTable[Week]), [Invoice Count])

Month = Averagex(Values(DateTable[Month]), [Invoice Count])

 

HTH

Thist just seems to be giving me back the total number of invoices Capture.PNG

Have you a date table linked to your Invoice Header? The Date part of the measure I provided needs to be passed through the date table and not the fact table. Hence why you're getting everything. It provides the context for the average.

 

I have a Date_Dim table thats joins to my Invoice_Table and it shows the same results. I can do an actual count by day with no issues, but when i add the average it gives me a total count of invoices
Capture.PNG

@GlitchedDuck Wrap it with DAY function.

Day = Averagex(Values(DAY(DateTable[DateColumn])), [Invoice Count])

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

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.