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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
LotteLaugesen
Helper V
Helper V

SELECTEDVALUE in calculation not working

Hi 

I have a filter this filter: 

LotteLaugesen_0-1638879583280.png

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.

 

1. CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),Dim_Items[Item Type]="B-Grade")
2. CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),Dim_Items[Item Type]="Waste")
3. CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),Dim_Items[Item Type]=SELECTEDVALUE(Dim_Items[Item Type]))
 
Can anybody give me a hint?
 
BR 
Lotte
 
1 ACCEPTED SOLUTION

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 
 

View solution in original post

8 REPLIES 8
VahidDM
Super User
Super User

Hi @LotteLaugesen 

 

Try these 3:

1. CALCULATE(SUM(FT_StockTransactionsDetailed[Kg]),Filter(All(Dim_Items),Dim_Items[Item Type]="B-Grade"))
2. Dim_Items
3. 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/


 

Thank you for answering, but it was me that made a mistake, so I close the case

Mikelytics
Resident Rockstar
Resident Rockstar

@LotteLaugesen 

 

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.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Unfortunately it doesn't help...

nandukrishnavs
Community Champion
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

 

 


Regards,
Nandu Krishna

Unfortunately it doesn't help

@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?


Regards,
Nandu Krishna

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 
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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