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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Randomlndex0
New Member

Output value from selected row, but other column in card

Product Name =  IF(COUNTROWS(DISTINCT(ALLSELECTED('Production Product'[StandardCost])))<COUNTROWS(DISTINCT(ALL('Production Product'[StandardCost]))),
                    IF(COUNTROWS(DISTINCT(ALLSELECTED('Production Product'[StandardCost]))) >= 2 ,
                        "Multiple Selected",
                        /* value of 'Production Product'[Name] from the selected 'Production Product'[StandardCost] row*/
                    ),
                    "All Selected"
                )

As the Subject says, I want to Output a Value into a Card.
The Selection of the StandardCost takes place in a Line chart and the output : "All Selected" and "Multiple Selected" works without Issue, but I can't seem to find a way to output the Name String from the Name column.

 

I am using the AdventureWorks2012 Database from Microsoft if that helps in any way.

1 ACCEPTED SOLUTION

@Randomlndex0 

 

Since you have not given us any model and data to work with, it's almost obvious that formulas can have typos in them. We can't test them, of course. But that's not even a minor issue since you can easily correct the typos.

 

I gave you a hint in the SWITCH to use CONCATENATEX to output all the visible names. Please consult the definition of SELECTEDVALUE to understand when it returns BLANK and then use CONCATENATEX to output all the visible  values.

View solution in original post

3 REPLIES 3
daxer-almighty
Solution Sage
Solution Sage

[Product Name] =
// You should never calculate anything more than once...
// If you do, you are slowing things down.
var SelectedCostsCount = 
    COUNTROWS(
        ALLSELECTED ( 'Production Product'[StandardCost] )
    )
var AllCostsCount = 
    COUNTROWS(
        ALL ( 'Production Product'[StandardCost] )
    )
var Result =
    switch( true,
    
        SelectedCostCount = AllCostCount,
            "All Selected",
            
        SelectedCostCount > 1, 
            "Multiple Selected",
            
        SelectedCostCount = 1,
            // I assume that if one cost has been selected,
            // it means that only one product will be visible
            // in the Production Product table. If this is
            // not the case, you can use CONCATENATEX to output
            // all the names in a comma-separated format.
            SELECTEDVALUE( 'Production Product'[Name] ),
        
        // guard clause
        SelectedCostCount = 0, "This should not happen"
    ) 
return
    Result

1. Thanks for the tip with the variables.
2. Your variable names don't match, since you wrote SelectedCostsCount and AllCostsCount in the declaration.
3. Sadly it doesn't output the Product Name and returns as (Blank).

@Randomlndex0 

 

Since you have not given us any model and data to work with, it's almost obvious that formulas can have typos in them. We can't test them, of course. But that's not even a minor issue since you can easily correct the typos.

 

I gave you a hint in the SWITCH to use CONCATENATEX to output all the visible names. Please consult the definition of SELECTEDVALUE to understand when it returns BLANK and then use CONCATENATEX to output all the visible  values.

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (25)