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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ryanjparks
Helper I
Helper I

SELECTEDVALUE - Sum With Multiple Selections

Hello Everyone,

 

I have a question as to how I can apply a multiple criteria selection in a Slicer and sum up the total? Unfortunately this is not as simple as it sounds. I need to list the Customer and their Total Sales next to each other in a Table, as well as the Selected Sales next to Total Sales.

 

Even if Selected Sales is $0, I need to display that row because the Customer has other sales. This is what I have for the DAX measure for Selected Sales:

 

 

Selected Product Sales = 
    VAR a = SELECTEDVALUE(MySales[Product],0)
    VAR b = 
        CALCULATE(
        SUM(MySales[Amount]),
        FILTER(MySales, MySales[Product] = a)
    )
    RETURN b+0

 

 

The slicer is set to select the Product from the Product Table, which is not related to the MySales table. This all works perfectly when selecting a single Product. But when I select multiple products, the resulting Sum of Selected Sales goes to $0.

 

How can I change this to sum up the total sales of all Products selected in the slicer? SELECTEDVALUE doesn't seem to be the appropriate option...

 

Thanks for any help!

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

To get 1 or more selected values you can use VALUES, e.g.

Selected Product Sales =
CALCULATE (
    SUM ( MySales[Amount] ),
    TREATAS ( VALUES ( 'Product'[Product] ), MySales[Product] )
) + 0

View solution in original post

2 REPLIES 2
ryanjparks
Helper I
Helper I

Wow, that was fast and worked perfectly! Thank you so much!!!

johnt75
Super User
Super User

To get 1 or more selected values you can use VALUES, e.g.

Selected Product Sales =
CALCULATE (
    SUM ( MySales[Amount] ),
    TREATAS ( VALUES ( 'Product'[Product] ), MySales[Product] )
) + 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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