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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
lawada
Helper III
Helper III

replacing zeros with blanks after current month

hello everyone! 

 

i have created a cohort for (total users who canceled and returned) using a matrix visual as follows:

rows: cancelation month

columns : difference between cancelation month and retention month

values:  [total users]

 

lawada_0-1636619290419.png

as you can notice the rows represents current month+1 

ex. if current month is obtober2021 :

0= obtober2021

1= november2021

2= december2021

and so on

 the thing is , when month is after the current month , ex 'December2021 and not reached yet , i want the value to show blank instead of zero and only show zero when month is before current month 

 

Example: if im in october2021, and November2021 value is zero , i want to see 0 for november2021 and Blank for december2021 because it's not reached yet

 

note that in order to get zeros in the matrix , i had to join  with another table that had index column  (using generate_series)

because when i used the index column inside my table i couldnt get any zeros and it was only blanks wether its before current month or after

lawada_1-1636620176902.png

 

so, what i want to get is : zero when month is before current month and blank if it's after current month

 

appreaciate the help!

 

 

1 ACCEPTED SOLUTION

Hi, 

According to your description and sample picture, I think you can simply change your DAX formula like this to achieve your needs:

 

total users = 
var _value=
CALCULATE(DISTINCTCOUNT(table[user_id]))
return
if(_value=blank(),0,_value)

 

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

3 REPLIES 3
VahidDM
Super User
Super User

Hi @lawada 

 

Can you share a sample of your PBIX file after removing sensetive data?

Or if you use any measure share codes with us?

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

i have used only one measure to count total users :

total users = CALCULATE(DISTINCTCOUNT(table[user_id]))+0
 

Hi, 

According to your description and sample picture, I think you can simply change your DAX formula like this to achieve your needs:

 

total users = 
var _value=
CALCULATE(DISTINCTCOUNT(table[user_id]))
return
if(_value=blank(),0,_value)

 

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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