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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
jhdavis
Regular Visitor

Measure based on Parameter

I'm trying to use the parameter function in PBI desktop to find cost index: countries' unit costs divided by a baseline country's unit costs. The baseline country is the parameter country that I would change. Here is the current measure DAX that isn't working:

Cost Index = DIVIDE([Unit Cost],CALCULATE([Unit Cost],CountryParameter[CountryParameter]))

 

The measure of [Unit Cost] is working, so the problem isn't there.

 

Here's how my parameter is currently set up:

Capture.PNG

 

I've tried it both related to the country dimension table and with no relationships at all. I believe it isn't supposed to be related to anything.

 

Thoughts?

1 ACCEPTED SOLUTION
jhdavis
Regular Visitor

I figured it out, so I'll post what I did on here in case someone comes across this in the future.

 

I created a separate blank query then "entered data" by pasting a column of all unique country names. Then measure DAX:

Client Cost Index = CALCULATE(DIVIDE([Unit Cost],CALCULATE([Unit Cost],Vendors[VendorCountry]=VALUES(Parameter[ParameterCountry]))),FACTS[FactSource]="Client")

Then just throw another slicer on the dashboard and drop the [parametercountry] in it. It'll show an error on any visual unless only one selection on that slicer is selected.

View solution in original post

3 REPLIES 3
jhdavis
Regular Visitor

I figured it out, so I'll post what I did on here in case someone comes across this in the future.

 

I created a separate blank query then "entered data" by pasting a column of all unique country names. Then measure DAX:

Client Cost Index = CALCULATE(DIVIDE([Unit Cost],CALCULATE([Unit Cost],Vendors[VendorCountry]=VALUES(Parameter[ParameterCountry]))),FACTS[FactSource]="Client")

Then just throw another slicer on the dashboard and drop the [parametercountry] in it. It'll show an error on any visual unless only one selection on that slicer is selected.

jhdavis
Regular Visitor

Cost Index = DIVIDE([Unit Cost],CALCULATE([Unit Cost],Vendors[Country]=VALUES(CountryParameter[CountryParameter])))

 

I changed it to this ^ and got numbers that look right when the parameter is set to China. but now when i change the parameter to say, Vietnam, it isn't updating anything.

 

Thoughts?

jhdavis
Regular Visitor

I've tried adding in that the country dimension is equal to the parameter as well

Cost Index = DIVIDE([Unit Cost],CALCULATE([Unit Cost],Vendors[Country]=CountryParameter[CountryParameter]))

 

no luck

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.