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

When no filter selected, result shows zero instead of total

Hi!  Can anyone point me toards a starting point for this problem.  This is my dashboard:

 

Capture.PNG

 

I have a table with products and stock.  Some of the stock has been marked with an 'action' e.g. sell or destroy

 

I want the user to be able to select the action(s) and then see what would be total stock afterwards, if we removed all the stock marked with that action.

 

i.e. in this visual, the user can see current total stock on the left, they then select one or more actions in the middle, and the cards on the right would show what the total stock would be after removing that stock:

 

Untitled.png

 

I have managed to make a couple of measures which kind of do this:

 

 This one goes in the card for Remaining Stock:

UoM Exclude = [UoM Include] - [UoM TM]

 

This one goes in the card for Total Stock, and the interaction between the filter has also been turned off:

UoM TM = CALCULATE(

SWITCH(TRUE(), 
VALUES(SwitchUoM[SwitchUoM]) = "Value GBP", [SumValue], 
VALUES(SwitchUoM[SwitchUoM]) = "Volume AC", [SumVolumeAC],
VALUES(SwitchUoM[SwitchUoM]) = "Volume EU", [SumVolumeEU], 
VALUES(SwitchUoM[SwitchUoM]) = "No. of SKUs", [SumDistinctSKUs], 
[SumVolume9L])

, FILTER(ALL(Inventory[InventoryDate]) , Inventory[InventoryDate] = MAX(Dates[Date]))
)+0

 

And this is the measure which just sits inbetween to make the caluclations work:

UoM Include = 
CALCULATE(

SWITCH(TRUE(), 
VALUES(SwitchUoM[SwitchUoM]) = "Value GBP", [SumValue], 
VALUES(SwitchUoM[SwitchUoM]) = "Volume AC", [SumVolumeAC],
VALUES(SwitchUoM[SwitchUoM]) = "Volume EU", [SumVolumeEU], 
VALUES(SwitchUoM[SwitchUoM]) = "No. of SKUs", [SumDistinctSKUs], 
[SumVolume9L])
, 
FILTER(ALL(Inventory[InventoryDate]) , Inventory[InventoryDate] = MAX(Dates[Date])),
ALL(Inventory[Action])
)+0

 

 

Howver, when I deselect everything, it shows zero instead of showing total stock.

 

Capture2.PNG

 

Any help?  Why is it showing zero and how can I fix it?

1 ACCEPTED SOLUTION

I fixed it using:

 

UoM Exclude = IF ( ISFILTERED ( Inventory[Action] ), ([UoM Include] - [UoM TM]), [UoM TM] )

View solution in original post

2 REPLIES 2

I fixed it using:

 

UoM Exclude = IF ( ISFILTERED ( Inventory[Action] ), ([UoM Include] - [UoM TM]), [UoM TM] )

Hi @dapperscavenger ,

 

Please kindly Accept it as the solution. More people will benefit from it.

 

Best Regards,

Stephen Tao

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.