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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
dswinden
Helper II
Helper II

Handling Data That is non-existent to calculate as 0

I have a dataset that i will filter by;

Month Start (start of the month)

Territory Name (Name of our sales territory)

Account Name (Name of the retailer)

SKU Name (Name of the SKU being measured)

 

I want the measure to show up as a 1 or 0 (1 = In Stock, 0 = Out of stock).

 

There will be 1000's of examples where there is no data for a SKU at a given store (example below) due to the fact that the store has never ordered this product.  I want this instance to show as a 0

 

The screen shot below will hopefully help;

 

The YELLOW section is a sample of what my data looks like.  

The BLUE section is a simple excel logic

if(Sumifs()>0,1,0)

 

dswinden_0-1695177614444.png

 

I have tried;

 

if(INVENTORY>0,1,0), and this only works for stores where there is data

 

I have tried COALESCE a few different ways, same result.  SWITCH, same result.

 

Any other ideas?

 

 

2 REPLIES 2
RSC
Helper I
Helper I

Hi @dswinden,

If you already created a measure which is counting INVENTORY, then that is fine.

We just need to add one more condition to the if statement, which is:

if(INVENTORY>0 && INVENTORY<>BLANK(),1,0)

 
I think this measure can help you,

Still facing issue, fell free to ask...

Thanks!

Hi @RSC Thanks for your reply, but still gives me blank cells instead of 0/1

If i don't filter the dataset at all, then i can at least visually see the store name and a blank next to it.

However, if i were to filter my example to "SKU 1" i would only see three stores instead of the four with a 0 next to Joseph's store

 

The use case for this is for a salesperson to be able to see all of their stores regardless of the SKU it is filtered to with 1 (listed) and 0 (not listed) next to it

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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