cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vladimir_P
New Member

Putting zero value in blank field

Dear Community,

I’m trying to calculate the revenue difference between the current and previous year. For each category where I didn’t have revenue in the previous year, the field is blank. The DAX formula for revenue difference also presents a blank field for these categories.

Can someone help me with DAX to present number zero in the blank fields for the previous year? That way, I believe, the revenue difference will be presented as it should be.

Please see the picture below:

Vladimir_P_0-1630259369481.png

 

Thanky you a lot!
Vladimir

 

1 ACCEPTED SOLUTION
nandic
Super User
Super User

Hi @Vladimir_P ,

In most cases it would be expected to have blank value if data is missing or if we divide values with zero.
However, if you have business target to display these blanks as zeros, you can set it within IF statement.

Example:

if(

   isblank(

          CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)

   )

   ,0

   ,CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)

)

Cheers,
Nemanja Andic

View solution in original post

2 REPLIES 2
nandic
Super User
Super User

Hi @Vladimir_P ,

In most cases it would be expected to have blank value if data is missing or if we divide values with zero.
However, if you have business target to display these blanks as zeros, you can set it within IF statement.

Example:

if(

   isblank(

          CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)

   )

   ,0

   ,CALCULATE([Sales],SAMEPERIODLASTYEAR(tblDate[Date]),date)

)

Cheers,
Nemanja Andic

View solution in original post

Hello @nandic ,


Thank you very much! It works very well in my model 🙂
The essential thing was to present data in the field "Revenue difference". Before your solution, this was not possible. Thank you for that!

Have a nice day!
Vladimir

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!