Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi all,
I am trying to count how many of occurence from a measure but I don't know why my CALCULATE function didn't work.
Here is my table:
From left to right:
actual table,
count of occurence for each 'Name',
cards for (I use quick measure), the bottom card is below formula with '-1' at the end.
Solved! Go to Solution.
Hi @Irisohyama6
The issue is that you are filtering manually the "Yes" attendance. The auto generated quick measure does not now that therfore it is calculating the max count weather the attendance is "Yes" or "No" (I also did the same mistake in my measure). The other thing is that if you place this measure (The max attendance) in the matrix you will not get the same result in all rows as it does not remove the filter from the names column (actually for some reson which is unknow to me it strangely KEEPFILTERS the values of the Names column. However that can be fixed as follows:
[# Attendence = Yes] = COUNTROWS ( FILTER ( 'Table', 'Table'[Attendance] = "Yes" ) )
# Max Attended =
CALCULATE (
MAXX (
CALCULATETABLE ( VALUES('Table'[Name] ), 'Table'[Attendance] = "Yes" ),
CALCULATE ( COUNTROWS ('Table') )
),
ALL ('Table'[Name] )
)
Count of Occurence =
SUMX (
CALCULATETABLE ( VALUES ( 'Table'[Name] ), 'Table'[Attendance] = "Yes" ),
CALCULATE ( IF ( [# Attendence = Yes] = [# Max Attended], 1, 0 ) )
)
Hi @Irisohyama6
you may try
Count of Occurence =
SUMX (
VALUES ( 'Table'[Name] ),
CALCULATE ( IF ( [# Attendence = Yes] = [# Max Attended], 1, 0 ) )
)
I got this:
That's probably not right because number of 3 occur only once.
Hi @Irisohyama6
The issue is that you are filtering manually the "Yes" attendance. The auto generated quick measure does not now that therfore it is calculating the max count weather the attendance is "Yes" or "No" (I also did the same mistake in my measure). The other thing is that if you place this measure (The max attendance) in the matrix you will not get the same result in all rows as it does not remove the filter from the names column (actually for some reson which is unknow to me it strangely KEEPFILTERS the values of the Names column. However that can be fixed as follows:
[# Attendence = Yes] = COUNTROWS ( FILTER ( 'Table', 'Table'[Attendance] = "Yes" ) )
# Max Attended =
CALCULATE (
MAXX (
CALCULATETABLE ( VALUES('Table'[Name] ), 'Table'[Attendance] = "Yes" ),
CALCULATE ( COUNTROWS ('Table') )
),
ALL ('Table'[Name] )
)
Count of Occurence =
SUMX (
CALCULATETABLE ( VALUES ( 'Table'[Name] ), 'Table'[Attendance] = "Yes" ),
CALCULATE ( IF ( [# Attendence = Yes] = [# Max Attended], 1, 0 ) )
)
Thank you very much.
I knew it was something to do with filters that was missing, but I was unsure where and how I would do it.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |