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.
Hello
I would like to return 0 instead of blank().
I tried following the instructions here https://www.sqlbi.com/articles/how-to-return-0-instead-of-blank-in-dax/ and other variations, but the results seem to ignore any filters I have on the report and populates in data fields where it shouldn't.
I have a matrix visual with columns from the Date & Department dimensions. Which have a one to many relationship with the FACT table. The Fact Table collects lets say Deadline Data and if there is no date for a Deadline then there
When I add any of the measures it shows 0 in all Dates where the result is BLANK(), Ideally I only want to show 0 on the dates that appear only in the FACT table and not all dates from the Date table
Entries =
IF (
CALCULATE(
COUNT('FACTTable'[ID]),
'FACTTable'[Valid Entry] = 1 ) = BLANK(),
0,
CALCULATE(
COUNT('FACTTable'[ID]),
'FACTTable'[Valid Entry] = 1 )
)
Thanks in advance
Solved! Go to Solution.
@JB_AT Hi! Try with:
Entries =
VAR ValidEntries =
CALCULATE(
COUNT('FACTTable'[ID]),
'FACTTable'[Valid Entry] = 1
)
RETURN
IF(
ISBLANK(ValidEntries),
0,
ValidEntries
)
BBF
Hi,
I tried to create a sample pbix file like below.
Please check [Entry measure fix:] measure in the below picture and the attached pbix file.
Entry measure fix: =
VAR _periodstart =
CALCULATE ( MIN ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _periodend =
CALCULATE ( MAX ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _result =
CALCULATE (
COUNTROWS ( VALUES ( 'fact'[department_id] ) ),
'fact'[valid_entry] = 1
)
RETURN
IF (
MAX ( 'calendar'[Date] ) >= _periodstart
&& MIN ( 'calendar'[Date] ) <= _periodend,
_result + 0
)
Thank you this worked 🙂
Hi,
I tried to create a sample pbix file like below.
Please check [Entry measure fix:] measure in the below picture and the attached pbix file.
Entry measure fix: =
VAR _periodstart =
CALCULATE ( MIN ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _periodend =
CALCULATE ( MAX ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _result =
CALCULATE (
COUNTROWS ( VALUES ( 'fact'[department_id] ) ),
'fact'[valid_entry] = 1
)
RETURN
IF (
MAX ( 'calendar'[Date] ) >= _periodstart
&& MIN ( 'calendar'[Date] ) <= _periodend,
_result + 0
)
@JB_AT Hi! Try with:
Entries =
VAR ValidEntries =
CALCULATE(
COUNT('FACTTable'[ID]),
'FACTTable'[Valid Entry] = 1
)
RETURN
IF(
ISBLANK(ValidEntries),
0,
ValidEntries
)
BBF
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |