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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

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:

temp1 =
SUMMARIZE
(
SELECTCOLUMNS -- build a table with 1 column.
(
FILTER
(
cust_with_multiples,
cust_with_multiples[startdate] <= MAX ( 'date'[Date] )
&& cust_with_multiples[stopdate] > MAX ( 'date'[Date] )
)
,"customer1", cust_with_multiples[customer] -- the column to return from the selectcolumns().
)
, [customer1], "prods_pers_cust", COUNTROWS(cust_with_multiples[customer])
)
 
The "cust_with_multiples" table contains:
customerstartdatestopdate
a01/01/201726/12/2018
b31/01/201707/04/2018
c02/03/201716/05/2018
c01/04/201703/04/2018
c01/05/201729/10/2018
f31/05/201730/11/2018
g30/06/201722/11/2018
h30/07/201714/05/2019
i29/08/201730/05/2019
j28/09/201715/12/2018
k28/10/201726/10/2019
l27/11/201708/01/2019

 

And the "date" table is built by: 

date = CALENDAR(date(2017,1,1), date(2023,1,1))

 

My desired output from the temp1 measure would be like this:

customer  prods_pers_cust

a     1

b     1

c     3

f      1

....

 

Thanks.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , check if this between logic can help

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

 

Please try:

Measure = CALCULATE(COUNT('Table'[customer]),FILTER('Table',[startdate]>=MIN('date'[Date]) && [stopdate]<=MAX('date'[Date])))

Output:

Recording 2022-05-02 at 17.10.17.gif

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.

amitchandak
Super User
Super User

@Anonymous , check if this between logic can help

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.