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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Calculating Values in DAX using a parameter

Hello! 

 

I have recently been struggling to using a paramter in caluclations in DAX. Currently I have been attempting to use a parameter for a user to input the years of interest. After determining the years of interest the hope is to be able to identify the range (and eventually perform specific calculations on those years. 

 

I have began this process with a simple identifying DAX code but it seems to not recognize the values correctly and I am unsure why. I will describe my process below... 

 

1. Import table (Table4) of years ([years]). 

 

2. Create parameter using the modeling tab in the desktop for values 2000-2016. DAX code seen below for paramter. 

 

"Parameter Years (strt) = GENERATESERIES(2000, 2030, 1)"

 

3. Create a measure referencing this parameter. DAX seen below. 

 

"Measure = selectedvalue('Parameter Years (strt)'[Parameter Years])"

 

4. Reference this measure in a new column. DAX seenbelow. 

 

"Identifier Column = if(Table4[Years] = [measure],1,0)"

 

When the parameter is set to 202 (or any other value) all of the values in the new custom column read 0. Although if I change the dax formula for the column to represent a number rather than the measure the formula works correctly and identifies the number I was looking for. With saying this I was wondering if there were specific limitations to using measures and or parameters in calculationsin this scenario? 

 

Thanks in advance. I would be happy to provide more information if it is needed as well! 

 

Austin I 

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi  @Anonymous ,

 

What if parameter can only be used in measure instead of calculated column, so you can create measure like DAX below.

 

Identifier Column = if(MAX(Table4[Years]) = [measure],1,0)

 

You can learn more:https://docs.microsoft.com/en-us/power-bi/desktop-what-if.

 

Best Regards,

Amy

 

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

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi  @Anonymous ,

 

What if parameter can only be used in measure instead of calculated column, so you can create measure like DAX below.

 

Identifier Column = if(MAX(Table4[Years]) = [measure],1,0)

 

You can learn more:https://docs.microsoft.com/en-us/power-bi/desktop-what-if.

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Gosh this seems so simple when you explain it that way but thank you so much! That worked perfectly! 

 

Austin I 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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