Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Replace blank value with 0

Hi,

I did a distinct count on session ID in my logfiles.
Where there were no sessions Power BI provides a blank instead of a 0. 

I used "Sessie ID met 0 = DISTINCTCOUNT('logfile'[Sessie ID]) + 0" to replace the blank with a 0.
Unfortunately this gives me zeros from Jan 2017 until Dec 2019 while I only have logfiles loaded from Aug 2017 until Jun 2019.

Of course it has something to do with my autocalender I created (see below).

Any ideas on it?


Datum =
VAR MinYear = YEAR ( MIN ( 'logfile'[Tijd] ) )
VAR MaxYear = YEAR ( MAX ( 'logfile'[Tijd] ) )
RETURN
ADDCOLUMNS (
FILTER (
CALENDARAUTO( );
AND ( YEAR ( [Date] ) >= MinYear; YEAR ( [Date] ) <= MaxYear )
);

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi HansK, 

Which visual did you use  in report? If you use Matrix, you could refer to this similar post(Display zero instead of blank in matrix) for more details. If you ue Table, you could try to use ramsyBI's suggestions, which should work.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi HansK, 

Which visual did you use  in report? If you use Matrix, you could refer to this similar post(Display zero instead of blank in matrix) for more details. If you ue Table, you could try to use ramsyBI's suggestions, which should work.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

You can use Isblank funtion:

 

Measure = if(ISBLANK([OrigMeasure]),0,[OrigMeasure])

 

"Sessie ID met 0= if(ISBLANK(DISTINCTCOUNT('logfile'[Sessie ID]),0,DISTINCTCOUNT('logfile'[Sessie ID]))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.