Forum Discussion
Bucketing average values from measure into bins/groups
- 5 years ago
Hi obothewizard ,
You are making the countrows of the orders levels, that means that you are not counting the number of customers but all the rowes in the orders tables. You need to summarized table with the customer ID and the averageX values and used it on your calculations something like this:
Avg Days Dist Cust = IF ( HASONEVALUE ( 'Order Elapse Table'[Min] ), COUNTROWS ( FILTER ( SUMMARIZE ( Order, Order[CustDI], "AVERAGEDAYS", [Average Days Between Orders] ), [AVERAGEDAYS] >= VALUES ( 'Order Elapse Table'[Min] ) && [AVERAGEDAYS] < VALUES ( 'Order Elapse Table'[Max] ) ) ), DISTINCTCOUNT ( Order[CustID] ) )Be aware that this code is done by head just looking at your data, without further information about your data is difficult to pion point the error.
If this does not work can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
Hi obothewizard ,
You are making the countrows of the orders levels, that means that you are not counting the number of customers but all the rowes in the orders tables. You need to summarized table with the customer ID and the averageX values and used it on your calculations something like this:
Avg Days Dist Cust =
IF (
HASONEVALUE ( 'Order Elapse Table'[Min] ),
COUNTROWS (
FILTER (
SUMMARIZE ( Order, Order[CustDI], "AVERAGEDAYS", [Average Days Between Orders] ),
[AVERAGEDAYS] >= VALUES ( 'Order Elapse Table'[Min] )
&& [AVERAGEDAYS] < VALUES ( 'Order Elapse Table'[Max] )
)
),
DISTINCTCOUNT ( Order[CustID] )
)
Be aware that this code is done by head just looking at your data, without further information about your data is difficult to pion point the error.
If this does not work can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
- obothewizard5 years ago
Helper I
Hi there,
Thank you for your reply.
I tried your new formula and it gave me the numbers I needed, so thanks very much for your time and help with this 🙂
Cheers