cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

How to input a value returned by measure to be inputed into a parameter?

How to input a value returned by measure to be inputed into a parameter?

So, I am using a nested min to get the minimum value of prices and return the name of the fighter with minimum strikes

 

But I want the value returned to be inputed into a parameter, so that it can be used later in different scenario

I created a nested if to return the fighter name for minimum strikes.How do I input the value returned by this measure into a parameter? For eg, I have a card that displays the hand strikes of the fighter with minimum strikes. How to populate that dynamically? 

Attached PBIX: https://drive.google.com/file/d/1l_THibyAAOuHnUDydw1GtgVFy6FXvZnX/view?usp=sharing"

 

Measure = 
var _Conor=calculate(SUM(Table1[Num]),FILTER(Table1,Table1[Fighters]="Conor"))
var _Nate=calculate(SUM(Table1[Num]), FILTER(Table1,Table1[Fighters]="Nate"))
var _GSP=calculate(SUM(Table1[Num]), FILTER(Table1,Table1[Fighters]="GSP"))
var _Jon=calculate(SUM(Table1[Num]), FILTER(Table1,Table1[Fighters]="Jon"))
return
if(MIN(_Conor,MIN(_GSP,MIN(_Nate,_Jon)))="Conor","Conor",
if(MIN(_Conor,MIN(_GSP,MIN(_Nate,_Jon)))="Nate","Nate",
if(MIN(_Conor,MIN(_GSP,MIN(_Nate,_Jon)))="GSP","GSP","Jon")))

 

1 ACCEPTED SOLUTION
Community Support
Community Support

Hi @soubhik ,

In your formula, the values of variables are numbers while you compare them with text type in the IF statement, it is not allowed in power bi and will show errors in the visuals.

You could modify the formula like this, compare them with themselves instead of text value

VAR _Conor =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "Conor" ) )
VAR _Nate =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "Nate" ) )
VAR _GSP =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "GSP" ) )
VAR _Jon =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "Jon" ) )
RETURN
    IF (
        MIN ( _Conor, MIN ( _GSP, MIN ( _Nate, _Jon ) ) ) = _Conor,
        "Conor",
        IF (
            MIN ( _Conor, MIN ( _GSP, MIN ( _Nate, _Jon ) ) ) = _Nate,
            "Nate",
            IF ( MIN ( _Conor, MIN ( _GSP, MIN ( _Nate, _Jon ) ) ) = _GSP, "GSP", "Jon" )
        )
    )

re.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Hi @soubhik ,

In your formula, the values of variables are numbers while you compare them with text type in the IF statement, it is not allowed in power bi and will show errors in the visuals.

You could modify the formula like this, compare them with themselves instead of text value

VAR _Conor =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "Conor" ) )
VAR _Nate =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "Nate" ) )
VAR _GSP =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "GSP" ) )
VAR _Jon =
    CALCULATE ( SUM ( Table1[Num] ), FILTER ( Table1, Table1[Fighters] = "Jon" ) )
RETURN
    IF (
        MIN ( _Conor, MIN ( _GSP, MIN ( _Nate, _Jon ) ) ) = _Conor,
        "Conor",
        IF (
            MIN ( _Conor, MIN ( _GSP, MIN ( _Nate, _Jon ) ) ) = _Nate,
            "Nate",
            IF ( MIN ( _Conor, MIN ( _GSP, MIN ( _Nate, _Jon ) ) ) = _GSP, "GSP", "Jon" )
        )
    )

re.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors