Forum Discussion
SELECTEDVALUE in calculation not working
Hi
I have a filter this filter:
and I'm trying to do a calculation depending the selected Item Type
Calculation no 1 is working fine and gives me the correct result, but no 2 and 3 are not working they return blank value.
Thank you for asking 😊
Because then I came to the thought that I have removed the interaction between the filter and report 🙄 - stupid me and sorry
8 Replies
- nandukrishnavs
Community Champion
LotteLaugesen Try this
VAR _selectedType = CALCULATE ( SELECTEDVALUE ( Dim_Items[Item Type] ) ) VAR _result = CALCULATE ( SUM ( FT_StockTransactionsDetailed[Kg] ), FILTER ( Dim_Items, Dim_Items[Item Type] = _selectedType ) ) RETURN _result- LotteLaugesen
Helper V
Unfortunately it doesn't help
- nandukrishnavs
Community Champion
LotteLaugesen My bad. If there is a relationship between FT_StockTransactionsDetailed and Dim_Items, then you don't need to specify it again in the filter parameter. Can you explain your scenario?
- Mikelytics
Resident Rockstar
Can you please try this
CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),ALL(Dim_Items[Item Type]),Dim_Items[Item Type]="Waste")
or
CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),ALL(Dim_Items),Dim_Items[Item Type]="Waste")
________________________
If this post helps, then please Accept it as the solution to help other community members find it more quickly
Click on the Thumbs-Up icon if you like this reply.
- LotteLaugesen
Helper V
Unfortunately it doesn't help...
- VahidDM
Super User
Try these 3:
1. CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),Filter(All(Dim_Items),Dim_Items[Item Type]="B-Grade"))2. Dim_Items3. SUM(FT_StockTransactionsDetailed[Kg]) -- IF there is a relationship between "FT_StockTransactionsDetailed" and "Dim_Items", when you select an item on slicer, that will filter the connected table as well.If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/- LotteLaugesen
Helper V
Thank you for answering, but it was me that made a mistake, so I close the case