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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to replace blanks with 0 for a measure when sliced

Hello all

 

I have a requirement where I have a measure [Count of Empty Bins] and it is a measure, when this measure is sliced I am getting blanks, I just want to replace them with 0. 

1Capture.JPG

 

 

I tried to do a IF condition as  - = If(ISBLANK([Count of Empty Bins]),0,[Count of Empty Bins]), and when I dragged over to report level filters, i have to select one among the if outcomes either 1 0r 0. 

 

1 ACCEPTED SOLUTION

change your measure to following

 

Count of Empty Bins:= 
var myEmptyBinCount = COUNTAX(FILTER(lagp,lagp[KZLER]="X"),lagp[Bin Number])
return if(Isblank(myEmptyBinCount ), 0, myEmptyBinCount )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

I'm not fully understood your question. You cannot use calculated measures on report level filters, it can be only used at visual level filter.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2kyes I agree I cannot use at report level filter. I am ok with any workaround but I need to achieve the goal where I want to replace those nulls with zeros of empty bin count in the visual I shared.

What happen when you drop that measure you created with if statement , not sure what that measure is called because it is not clear from your post.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Try following changes to you empty count measure

 

Empty Bin = 
var emptyCountBin = CALCULATE(Countrows(Table1), filter(table1, Table1[Column2]="Y"))
return if(ISBLANK(emptyCountBin ), 0, emptyCountBin )

Change this statement in measure with your formula

 

 

CALCULATE(Countrows(Table1), filter(table1, Table1[Column2]="Y"))

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Thank you for your time in replying. Can you please help me understand what you mean by Table1[Column2]. The empty bin measure is calcualted as below -

 

Count of Empty Bins:= COUNTAX(FILTER(lagp,lagp[KZLER]="X"),lagp[Bin Number])

 

This count is being sliced by warehouse, storage type etc. When there is no bin number corresponding to that warehouse, Storage Type, I am getting Null values and want to replace with zero. 

Hi @Anonymous,

 

Have you tried the solution provided by @parry2k above? Does it work in your scenario? If it works, could you accept it as solution to close this thread?

 

If you still have any question on this issue, feel free to post here. Smiley Happy

 

Regards

change your measure to following

 

Count of Empty Bins:= 
var myEmptyBinCount = COUNTAX(FILTER(lagp,lagp[KZLER]="X"),lagp[Bin Number])
return if(Isblank(myEmptyBinCount ), 0, myEmptyBinCount )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.