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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
misharaina
Advocate I
Advocate I

Using the parameter value in a measure

Using the parameter value in the measure doesn't work. Is this the standard behaviour?

 

Vol/mix new =
IF( SELECTEDVALUE('Parameter'[Parameter1]) = "Customer" && HASONEVALUE('CustomerTable'[Customer]),
       [Vol/Mix Impact],
         SumX( ADDCOLUMNS(SUMMARIZE('Segment (Control)','Segment (Control)'[Segment]), "Vol/Mix New2", Calculate([Vol/Mix       Impact])), [Vol/Mix New2]))
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

No just declare it as a variable before the calculation

Vol/mix new =
var valparameter=SELECTEDVALUE('Parameter'[Parameter1])
var result =if(HASONEVALUE('CustomerTable'[Customer]),
       [Vol/Mix Impact],
         SumXADDCOLUMNS(SUMMARIZE('Segment (Control)','Segment (Control)'[Segment]), "Vol/Mix New2"Calculate([Vol/Mix       Impact])), [Vol/Mix New2])))
 
return
result

View solution in original post

6 REPLIES 6
misharaina
Advocate I
Advocate I

I created a numeric column inside the parameter and it works now. Thanks for your help in letting me know that it was essential to create a separate variable for the selected parameter value. 

Anonymous
Not applicable

hat do you want to check on sgment ?

The parameter is composed of dimensions. The parameter column has the following values -

Parameter1

Products

Customers

Segments

 

I want to check if the "segment" is selected or not. 

Anonymous
Not applicable

Ok more complicatd. Can you send me a sample of your datas ?

Anonymous
Not applicable

Hi,

 

No just declare it as a variable before the calculation

Vol/mix new =
var valparameter=SELECTEDVALUE('Parameter'[Parameter1])
var result =if(HASONEVALUE('CustomerTable'[Customer]),
       [Vol/Mix Impact],
         SumXADDCOLUMNS(SUMMARIZE('Segment (Control)','Segment (Control)'[Segment]), "Vol/Mix New2"Calculate([Vol/Mix       Impact])), [Vol/Mix New2])))
 
return
result

Thank you @Anonymous ! I also want to check if the parameter value = "Segment" but it doesn't seem to work.

 

Vol/mix new =
var valparameter=SELECTEDVALUE('Parameter'[Parameter1])
var result =if(HASONEVALUE('Segment (Control)'[Segment]) ,
[Vol/Mix Impact],
SumX( ADDCOLUMNS(SUMMARIZE('Segment (Control)','Segment (Control)'[Segment]), "Vol/Mix New2", Calculate([Vol/Mix Impact])), [Vol/Mix New2]))
Return (IF (valparameter = "Segment", result, 0))

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.