Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to get create a measure which is a count of all records where flag1="yes". I am using this formula:
count1 = calculate(countrows('table1'),filter(all('table1'[uniqueID]),'table1'[flag1]="yes" )
I am getting this error:
"A single value for column 'flag1' in table 'program' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
Why is this? Is there another way to accomplish this?
Solved! Go to Solution.
When you specify a column in an ALL() statement, it returns a table with that single column. The second column you refer to does not exist in that table. Your formula should be this:
CALCULATE( COUNTROWS('table1'), FILTER( ALL('table1'), 'table1'[flag1] = "yes" ) )
Unless you were trying to use all('table1'[uniqueID]) to force the countrows to count each unique ID only once in a table that otherwise has duplicates. In that case you would want to do:
CALCULATE( DISTINCTCOUNT('table1'[uniqueID]), FILTER( ALL('table1'), 'table1'[flag1] = "yes" ) )
Proud to be a Super User!
When you specify a column in an ALL() statement, it returns a table with that single column. The second column you refer to does not exist in that table. Your formula should be this:
CALCULATE( COUNTROWS('table1'), FILTER( ALL('table1'), 'table1'[flag1] = "yes" ) )
Unless you were trying to use all('table1'[uniqueID]) to force the countrows to count each unique ID only once in a table that otherwise has duplicates. In that case you would want to do:
CALCULATE( DISTINCTCOUNT('table1'[uniqueID]), FILTER( ALL('table1'), 'table1'[flag1] = "yes" ) )
Proud to be a Super User!
It works, thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |