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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.