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
Anonymous
Not applicable

Average total by day-number of each month for a measured total.

Hi,

 

I have a dataset of starters , with their true start date, and also the date that they paid a deposit.

 

e.g.

Start Date                   Deposit Date                           Calendar Month        Starter

2022-06-02 00:00:00 2022-06-02 05:00:25.7480000 2022-06-01 00:00:00 1
2022-06-02 00:00:00 2022-05-26 09:15:02.4466667 2022-06-01 00:00:00 1
2022-06-02 00:00:00 2022-05-24 08:23:22.0766667 2022-06-01 00:00:00 1
2022-05-26 00:00:00 2022-05-11 14:06:23.9666667 2022-05-01 00:00:00 1
2022-05-26 00:00:00 2022-05-13 12:46:03.2166667 2022-05-01 00:00:00 1
2022-05-26 00:00:00 2022-05-20 09:10:57.9300000 2022-05-01 00:00:00 1

 

I use the following DAX to calculate, from each date , how many starters are 'known about' in the month from how many deposits are in the system as of that date which also stops data returning from the current date onwards, and accounts for starters on the day into the totals:

Starter Total =
IF(
MAX('dim_DateReference'[Date]) > TODAY(),
BLANK(),
IF(MAX('dim_DateReference'[Date]) = TODAY(),
CALCULATE(COUNT('PBI Starter'[Deposit Date]), ALL('dim_DateReference'[Day Number]),
'PBI Starter'[Deposit Date] <= MAX('dim_DateReference'[Date]) + 1, 'PBI Starter'[Start Date] <= EOMONTH(MAX('dim_DateReference'[Date]),0))
,CALCULATE(COUNT('PBI Starter'[Deposit Date]), ALL('dim_DateReference'[Day Number]),
'PBI Starter'[Deposit Date] <= MAX('dim_DateReference'[Date]), 'PBI Starter'[Start Date] <= EOMONTH(MAX('dim_DateReference'[Date]),0))
))

 

I need to calculate, for each day number of the month, on average how many starters are 'known about'.

I.E on day one of the month, we have 20 known starters for the month, on average we should know about 24 so we need to improve to meet monthly targets. I also have to plot the average by day against the current month actual.

 

Thanks in advance.

6 REPLIES 6
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous,

 

Not quite clear about your needs. Is this what you want? Average the Starter total by Month and Day number?

vcazhengmsft_0-1655791400472.png

 

AvgStarters =
VAR maxDays =
    CALCULATE (
        MAX ( dim_DateReference[Day number] ),
        ALLEXCEPT ( dim_DateReference, dim_DateReference[Month] )
    )
RETURN
    'PBI Starter'[Starter Total]
        / ( maxDays - SELECTEDVALUE ( dim_DateReference[Day number] ) )

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Anonymous
Not applicable

Geoff2044_0-1655796682392.png

 

Here is the format of the desired data. In this visual the series has been filtered with a date slicer to just show the June data, showing from each day, how many starters for the month were recorded in the system using the deposit date. I would like in adition to show an average series, for example showing on average how many starters were on the system on day 7 of the month, as a performance metric.

lbendlin
Super User
Super User

Please confirm that there is no active connection in your data model between the fact table and the dim_DateReference table.

Anonymous
Not applicable

For the purpose of displaying day number on the x axis of visuals, there is an active relationship between fact.start date, and date.date

That will not work for dates without data unless you enable that setting and filter your calendar table.

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Anonymous
Not applicable

Here is some better sample data:

 

Start DateDeposit DateStarter
09/06/2022 00:0001/06/2022 10:021
09/06/2022 00:0026/05/2022 15:421
09/06/2022 00:0025/05/2022 10:091
09/06/2022 00:0009/06/2022 05:001
09/06/2022 00:0009/06/2022 05:001
09/06/2022 00:0031/05/2022 10:051
09/06/2022 00:0031/05/2022 13:331
09/06/2022 00:0025/05/2022 11:181
09/06/2022 00:0006/06/2022 14:151
09/06/2022 00:0006/06/2022 20:101
09/06/2022 00:0006/06/2022 19:161
09/06/2022 00:0030/05/2022 11:231
09/06/2022 00:0001/06/2022 11:421
09/06/2022 00:0024/05/2022 10:591
02/06/2022 00:0025/05/2022 12:081
02/06/2022 00:0018/05/2022 13:331
02/06/2022 00:0026/04/2022 10:161
02/06/2022 00:0023/05/2022 11:371
02/06/2022 00:0002/06/2022 05:001
02/06/2022 00:0025/04/2022 11:451
02/06/2022 00:0018/05/2022 11:481
02/06/2022 00:0024/05/2022 08:231
02/06/2022 00:0026/05/2022 09:151
26/05/2022 00:0026/05/2022 05:001
26/05/2022 00:0020/05/2022 09:101
26/05/2022 00:0019/05/2022 09:101
26/05/2022 00:0017/05/2022 15:391
26/05/2022 00:0012/05/2022 14:441
26/05/2022 00:0026/05/2022 11:141
26/05/2022 00:0017/05/2022 09:411
26/05/2022 00:0017/05/2022 13:151
26/05/2022 00:0013/05/2022 15:311
26/05/2022 00:0019/05/2022 12:571
26/05/2022 00:0016/05/2022 12:431
26/05/2022 00:0012/05/2022 15:201
26/05/2022 00:0024/05/2022 09:521
26/05/2022 00:0011/05/2022 14:061
26/05/2022 00:0013/05/2022 12:461

 

As you can see there can be multiple starters on the same day, however they have different deposit dates and so will have been recorded onto the system at different dates.

 

Geoff2044_0-1655796252691.png

Here is the format of the desired data. In this visual the series has been filtered with a date slicer to just show the June data, showing from each day, how many starters for the month were recorded in the system using the deposit date. I would like in adition to show an average series, for example showing on average how many starters were on the system on day 7 of the month, as a performance metric.

 

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