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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Praj8050
Helper I
Helper I

Using Parameters in Dax calculation

Hello Community,

I am facing a challenge while trying to extract specific text from multiple category fields using DAX calculations 

Here's the situation:

I have a table with the following structure:

img5.PNG



My goal is to extract the text "Late" or "Early" from any of the categories (Category1, Category2, Category3, or Category4). I can successfully do this with individual column using a direct formula such as:

DAX
= IF(CONTAINSSTRING([Category1], "Late"), "Late", "Early")

However, I want to make this dynamic by using a parameter so that I can choose any category to extract the text from. For this purpose, I created a parameter (named `Parameter Selection`) for Category1, Category2, Category3, and Category4. My intention is to use the following formula to determine the text based on the selected category:

DAX
= IF(CONTAINSSTRING(['Parameter Selection`], "Late"), "Late", "Early")

Unfortunately, when I use this formula with the parameter, I encounter the following error:


imp6.PNG

 

Questions:
1. How can I resolve the error related to field relationships?
2. Is there a specific way to set up parameters in DAX calculations to avoid such issues?
3. What is the best approach to dynamically extract text like "Late" or "Early" from selected categories using parameters?

Any guidance or suggestions to solve this problem would be greatly appreciated.

Thank you for your help!

 

2 REPLIES 2
Praj8050
Helper I
Helper I

Hi

My requirement differs slightly: depending on the selected category, the output should display "Late" or "Early" for each value within that chosen category.
Ex

6.png

Anonymous
Not applicable

Hi first prepare measures for each category like the following

Rakesh1705_0-1720098446229.png

 

Create one parameter table

Rakesh1705_1-1720098509576.png

use the same parameter as slicer and part of the output table

 

Rakesh1705_2-1720098569916.png


If the above meets your requirement then pls accept the same as your solution.

 



Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.