Forum Discussion
Measure combining filter and group by (or similar function)
- 3 years ago
Hi Ashish_Mathur ,
When I try this measure, I get an error when entering the FilterExpression. Here
[DaysAgo]>=120&&[Event]="Incomplete1"&&[count]>=10
Is not recognized. The message 'Cannot find name ...' appears.
COUNTROWS(
FILTER(
VALUES(
table[ID]
),
table[DaysAgo] <=120 &&
table[eventname]="Incomplete1" &&
COUNTROWS(
table
) >= 10
)
)I think this is because the function 'VALUES' within the filter only relates to the [ID] column of the table, so this is the only table that is recognized to use in the FilterExpression.
What I tried myself is the following:
1. Filtering for DaysAgo and eventname is succesful.
2. Grouping by ID (using SUMMARIZE or SUMMARIZECOLUMNS) is also succesfull, only when I start with this step the DaysAgo information is lost because of the grouping
3. When applying the filter first, I cannot seem to refer to the newly generated filtered table.
This got me thinking.. and instead of generating a measure for the filters I generated a new table. Here I applied the same logic as in the measure, only resulting in a table. This table as turned out could be used in the SUMMARIZECOLUMNS function. So now I have my column with filters and grouping! 🙂
Final filter table:
_Incompmlete1Filter =
FILTER(
table,
table[eventname] = "Incompmlete1" &&
table[DaysAgo] <= 120
)Final count table:
_Incomplete1Count =
SUMMARIZECOLUMNS(
_Incompmlete1Filter[ID],
_Incompmlete1Filter[eventname],
"Count",
COUNT(
_Incompmlete1Filter[eventname]
)
)Thanks for thinking along!
Kind regards,
Bart
BartvDonkelaar With ID in your table visual, try something like:
Measure =
VAR __Table = FILTER('Table', [DaysAgo] >= 120 && [Event] = "Incomplete1")
VAR __Count = COUNTROWS(__Table)
VAR __Result = IF(__Count >= 10, 1, 0)
RETURN
__Result
Basically a Complex Selector: The Complex Selector - Microsoft Power BI Community
Hi Greg_Deckler ,
Thank you for your reply!
Your solution does not however incorporate the ID.
I am only interested in a case when for any individual ID the count is 10 or higher. So 10 or more times 1234 for example. In your example you sum over the total count, which does not use ID.
Kind regards,
Bart