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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
derekli1700
Frequent Visitor

Need help with getting average monthly activity duration and monthly volume of customer

 
Date of ActionCustomerVolumeTransactionAssets
13/01/2020Customer A              44,499.2             1,148               60
5/03/2020Customer B                 2,186.1                    16                  1
5/06/2021Customer A           145,243.4                 508             106
26/08/2021Customer B                     631.6                    16                  4
5/04/2022Customer C                 1,423.1                    32               12
26/06/2022Customer A                     758.7                    15                  2
31/03/2023Customer C              62,440.1                 214               58
4/08/2023Customer C                 2,245.7                    17                  1
15/08/2023Customer B           220,562.9                 854               63
28/11/2023Customer A                 1,669.1                    29                  8
6/03/2024Customer C              42,202.8                    58               12
23/05/2024Customer B              26,053.9                 103               29
25/07/2024Customer A              15,330.9                 287               51
 
 

This is a sample simplified dataset of the datasheet i'm using for my PowerBI dashboard.

I wish to learn how to create 3 visuals:

  1. One card showing the overall average period of time (in months) for customer activities before ceasing

  2. One card showing the average monthly customer volume

  3. Would also be nice to calculate the average transaction per asset in a card visual too - if possible
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

PBi file attached.

Ashish_Mathur_0-1723687162718.png

 

 


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

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

PBi file attached.

Ashish_Mathur_0-1723687162718.png

 

 


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

what's the calculation logic? I don't think your request is just using average for the DAX.could you pls proivde the output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




To clarify,
For visual 1. It should just show how long the average customer stays active for. As seen in the above data set, Customer C's activity spans from 05/4/22 to 06/3/24 which should show 23 months on the visual card. However, i would like the visual card number output to reflect the average activity duration for all customers. For my example: Customer A spans 54 months, B spans 50 months and C spans 23 months, so the visual card should show the average duration amount as (54+50+23)/3: 127 months 

 

For visual 3: It's just to find the average customer ratio for transaction and assets. Eg) Customer A in the example dataset has 1987 total transactions and 227 assets. Therefore, the visual card should show 8.75 transactions per asset (because 1987 / 227). But like in visual 1 - i would like the total average transaction per asset for the overall customers.

@derekli1700 

pls try this

 

Measure =
var tbl = ADDCOLUMNS( SUMMARIZE('Table','Table'[Customer],"mindate",min('Table'[Date of Action]),"maxdate",max('Table'[Date of Action])),"month", DATEDIFF([mindate],[maxdate],MONTH))
return sumx(tbl,[month])
 
 
Measure 2 = sumx(FILTER('Table','Table'[Customer]="Customer A"),'Table'[Transaction])/ sumx(FILTER('Table','Table'[Customer]="Customer A"),'Table'[Assets])
 
11.PNG
 
pls see the attachment below
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hey thats really helpful thanks -

 

For measure 1, my main data has a date heirachy which shows quarter, months, days etc as a dropdown. Does the measure still work for this?

regarding measure 2, is there way for the measure to calculate the overall average customer transaction per assets (rather than one customer)? Thanks

for measure 1, not very clear about your request, you can have a try to see if it works.

there is something wrong in measure 1, pls use averagex instead of sumx

 

for measure 2, is the similar calculation logic you used for measure 1? 

 

var tbl = ADDCOLUMNSSUMMARIZE('Table','Table'[Customer],"mindate",min('Table'[Date of Action]),"maxdate",max('Table'[Date of Action])),"col",sum('Table'[Transaction])/sum('Table'[Assets]))
 
return average(tbl,[col])

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.