Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am having an issue.
I have a report that needs to show a list of "eligible" clients. Eligiblity is determined by having 2 or more completed services in the date range that is selected. Because the date range is a slicer I can't use a calculated collumn to determine eligibility. I tried using a virtual table but I can't seem to get the count of services to work. It will limit the list of clients counted to those that had at least 1 service but I can't get it to limit to those that had 2 services. Any ideas on how to procede? Here is the measure I am using right now. The column for "CountOfServices" seems to be returning the same count for every client. The measure returns the same value wether I have a filter on it or not.
Solved! Go to Solution.
Eligible Population =
VAR Tab1 =
CALCULATETABLE(
Addcolumn(
Values(dwh FactService'[clientID]),
"@CountOfServices",
Calculate( distinctcount(factService'[ProcedureKey])
),
'dwh FactService'[ProcedureKey] in {99, 136, 60, 123, 124, 125, 126, 65, 66, 67, 68}
&&
'dwh FactService'[Full Service Date] <= MAX('dwh DimDate'[SmallDate])
&&
'dwh FactService'[Full Service Date] >= MIN('dwh DimDate'[SmallDate])
&&
'dwh FactService'[Age at Time Of Service] > 17
&&
'dwh FactService'[ServiceStatusName] = "Complete"
)
RETURN
COUNTROWS(
FILTER(
tab1,
[@CountOfServices] > 1
)
)
Assumed you wanted count of distinct procedure key, swap back to count if not
You needed calculate to get context transition, so the row context of client id filtered the procedures
Thank you so much for the help.
I am looking for a total count of procedure key. Because the criteria is 2 or more completed in the list of procedure keys. But easy fix.
I actually tried to use calculate but it wasn't returning anything when I did. I am guessing using Addcollumns instead of Selectcollumns might have made a difference to.
Either way, it is working now.
Thanks again
Eligible Population =
VAR Tab1 =
CALCULATETABLE(
Addcolumn(
Values(dwh FactService'[clientID]),
"@CountOfServices",
Calculate( distinctcount(factService'[ProcedureKey])
),
'dwh FactService'[ProcedureKey] in {99, 136, 60, 123, 124, 125, 126, 65, 66, 67, 68}
&&
'dwh FactService'[Full Service Date] <= MAX('dwh DimDate'[SmallDate])
&&
'dwh FactService'[Full Service Date] >= MIN('dwh DimDate'[SmallDate])
&&
'dwh FactService'[Age at Time Of Service] > 17
&&
'dwh FactService'[ServiceStatusName] = "Complete"
)
RETURN
COUNTROWS(
FILTER(
tab1,
[@CountOfServices] > 1
)
)
Assumed you wanted count of distinct procedure key, swap back to count if not
You needed calculate to get context transition, so the row context of client id filtered the procedures
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |