Forum Discussion

elinevans's avatar
elinevans
Icon for Helper I rankHelper I
5 years ago
Solved

Active Clients Multiple Services

  Here is an example of the type the data I'm using. Each client can have more than 1 service and I want to find clients active in a service within a time period (say between date x and date y...
  • Anonymous's avatar
    Anonymous
    5 years ago
    [# Active Clients] =
    var MinReportingPeriod =
    	MIN( Datetable[Date] ),
    var MaxReportingPeriod =
    	MAX( Datetable[Date] )
    var Result =
    	COUNTROWS(
    		SUMMARIZE(
    			CALCULATETABLE(
    				ServiceInfo,
    				KEEPFILTERS(
    					ServiceInfo[Start Date] 
    						<= MaxReportingPeriod
    				),
    				KEEPFILTERS(
    					MinReportingPeriod
    						<= ServiceInfo[End Date]
    				)
    			),
    			ServiceInfo[Client Ref]
    		)
    	)
    return
    	Result