Forum Discussion
summarize and selectcolumns problems
Hi. I'm trying to SELECTCOLUMNS() to return a table with a single column [customer1] and then use SUMMARIZE() to count how many rows are present for each customer. This sounds fairly simple but I need to do it each month across a date range that is user-filterable.
I built a small demo model in Power BI to investigate the problem I am having with the "temp1" measure. The DAX is:
| customer | startdate | stopdate |
| a | 01/01/2017 | 26/12/2018 |
| b | 31/01/2017 | 07/04/2018 |
| c | 02/03/2017 | 16/05/2018 |
| c | 01/04/2017 | 03/04/2018 |
| c | 01/05/2017 | 29/10/2018 |
| f | 31/05/2017 | 30/11/2018 |
| g | 30/06/2017 | 22/11/2018 |
| h | 30/07/2017 | 14/05/2019 |
| i | 29/08/2017 | 30/05/2019 |
| j | 28/09/2017 | 15/12/2018 |
| k | 28/10/2017 | 26/10/2019 |
| l | 27/11/2017 | 08/01/2019 |
And the "date" table is built by:
My desired output from the temp1 measure would be like this:
customer prods_pers_cust
a 1
b 1
c 3
f 1
....
Thanks.
Anonymous , check if this between logic can help
2 Replies
- amitchandakSuper User
Anonymous , check if this between logic can help
- AnonymousNot applicable
Hi Anonymous ,
Please try:
Measure = CALCULATE(COUNT('Table'[customer]),FILTER('Table',[startdate]>=MIN('date'[Date]) && [stopdate]<=MAX('date'[Date])))Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.