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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Analitika
Post Prodigy
Post Prodigy

Visual and measure depending on parameter

How to create Visual which will depends on Parameter setted in Query editor?

  1. For example if Parameter setted to 1 Visual x axis column must be Table1[Name] but if Parameter setted to 2 Visual x axis column must be Table2[Val]
  2. Parameter setted to 1, measure must be 

 

 

Measure = CALCULATE (sum(Table1[Pre_ska_1]))​

 


but if Parameter setted to 2, measure must be

 

Measure = CALCULATE (sum(Table2[Pre_ska_2]))

 

 

 

PBI has something like INDIRECT() excel function? So i can In table dinamically change names which in measure interpreted like columns names

Measure = CALCULATE (sum(INDIRECT(Table1[DinamicName])))​

So if Table1[DinamicName] = "Table2[Pre_ska_2]"
measure
Measure = CALCULATE (sum(INDIRECT(Table1[DinamicName])))​ sum Table2[Pre_ska_2] values
1 ACCEPTED SOLUTION
nandukrishnavs
Community Champion
Community Champion

@Analitika 

 

You could try to below steps.

  1. Create a Parameter
  2. Create a reference for that Parameter and convert it to the table.
    1. Now you will get a table with single column and a single row.
  3. combine the tables (You can use PowerQuery/DAX) and add a calculated/custom column to identify the table name. 
  4. Now using DAX measure you can identify the parameter value.
    1. Example

 

 

 

ParameterMeasure = SELECTEDVALUE('Parameter1 (2)'[Column1])​

 

 

 

  • Using this measure you can switch the values 

 

Measure = 
var __parameter=SELECTEDVALUE('Parameter1 (2)'[Column1])
var __selectedColumn=SELECTEDVALUE('Table'[Column])
var __Table1=CALCULATE(SUM('Table'[Sales]),'Table'[Column]="Table1")
var __Table2=CALCULATE(SUM('Table'[Sales]),'Table'[Column]="Table2")
var __result=IF(__parameter=1&& __selectedColumn="Table1",__Table1,IF(__parameter=2&&__selectedColumn="Table2",__Table2,BLANK()))
return __result​


Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 

 


Regards,
Nandu Krishna

View solution in original post

3 REPLIES 3
nandukrishnavs
Community Champion
Community Champion

@Analitika 

 

You could try to below steps.

  1. Create a Parameter
  2. Create a reference for that Parameter and convert it to the table.
    1. Now you will get a table with single column and a single row.
  3. combine the tables (You can use PowerQuery/DAX) and add a calculated/custom column to identify the table name. 
  4. Now using DAX measure you can identify the parameter value.
    1. Example

 

 

 

ParameterMeasure = SELECTEDVALUE('Parameter1 (2)'[Column1])​

 

 

 

  • Using this measure you can switch the values 

 

Measure = 
var __parameter=SELECTEDVALUE('Parameter1 (2)'[Column1])
var __selectedColumn=SELECTEDVALUE('Table'[Column])
var __Table1=CALCULATE(SUM('Table'[Sales]),'Table'[Column]="Table1")
var __Table2=CALCULATE(SUM('Table'[Sales]),'Table'[Column]="Table2")
var __result=IF(__parameter=1&& __selectedColumn="Table1",__Table1,IF(__parameter=2&&__selectedColumn="Table2",__Table2,BLANK()))
return __result​


Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 

 


Regards,
Nandu Krishna

amitchandak
Super User
Super User

@Analitika , not very clear .

refer if these can help

Dynamically change chart axis in Power BI
https://www.youtube.com/watch?v=6jeSIRpjv0M

 

or

https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I need not depending on slicer,but depending on Parameter !!!
word-image

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.