The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a data like this
Column 1 | Column 2 |
null | 6 |
null | 3 |
null | null |
I am counting the occurrences of values greater than 9 in both columns but both columns returns null while in reality the column 1 should return null while the column two should return 0.
var column1 = COUNTROWS ( FILTER ( 'nps', 'nps'[Column 1] IN { 7, 8, 9, 10 } ) )
var column2 = COUNTROWS ( FILTER ( 'nps', 'nps'[Column 2] IN { 7, 8, 9, 10 } ) )
I am doing some other calculation at the end as well
Is there any way we can ignore the null values in the columns from calculations so that with the rows that have a data with values but returns a null I can force zero it?
@Anonymous
COUNTROWS of an empty table is BLANK not 0
To force zero use
var column2 = COUNTROWS ( FILTER ( 'nps', 'nps'[Column 2] IN { 7, 8, 9, 10 } ) ) + 0
Won't that automatically use 0 where the column or cell value is actually null and should remain the same?
@Anonymous
FILTER ( 'nps', 'nps'[Column 2] IN { 7, 8, 9, 10 } ) returns an empty table. Any aggregation of an empty table in DAX returns a blank not 0
Is there any way we can ignore the null values in the columns from calculations so that with the rows that have a data with values but returns a null I can force zero it?
@Anonymous
I aleady answered that in my first reply, just + 0
User | Count |
---|---|
24 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
29 | |
13 | |
11 | |
10 | |
9 |